memory

Gigabyte or Gibibyte (1000 or 1024)?

本小妞迷上赌 提交于 2021-01-26 18:38:55
问题 This may be a duplicate and I apologies if that is so but I really want a definitive answer as that seems to change depending upon where I look. Is it acceptable to say that a gigabyte is 1024 megabytes or should it be said that it is 1000 megabytes? I am taking computer science at GCSE and a typical exam question could be how many bytes in a kilobyte and I believe the exam board, AQA, has the answer for such a question as 1024 not 1000. How is this? Are both correct? Which one should I go

Gigabyte or Gibibyte (1000 or 1024)?

和自甴很熟 提交于 2021-01-26 18:37:52
问题 This may be a duplicate and I apologies if that is so but I really want a definitive answer as that seems to change depending upon where I look. Is it acceptable to say that a gigabyte is 1024 megabytes or should it be said that it is 1000 megabytes? I am taking computer science at GCSE and a typical exam question could be how many bytes in a kilobyte and I believe the exam board, AQA, has the answer for such a question as 1024 not 1000. How is this? Are both correct? Which one should I go

Gigabyte or Gibibyte (1000 or 1024)?

ⅰ亾dé卋堺 提交于 2021-01-26 18:37:52
问题 This may be a duplicate and I apologies if that is so but I really want a definitive answer as that seems to change depending upon where I look. Is it acceptable to say that a gigabyte is 1024 megabytes or should it be said that it is 1000 megabytes? I am taking computer science at GCSE and a typical exam question could be how many bytes in a kilobyte and I believe the exam board, AQA, has the answer for such a question as 1024 not 1000. How is this? Are both correct? Which one should I go

Log memory accesses that cause major page faults

痴心易碎 提交于 2021-01-22 06:46:26
问题 Does anyone know how to get the memory accesses (pointers) that cause page faults? I'm interested mostly in the major page faults. A bit of background about what I'm trying to achieve. I have an application with a large memory footprint (a database) and I want to correlate paging with the accesses to the large data structures (such as tables, indexes which are allocated using mmap()). The mappings of the process are easy to retrieve from /proc//maps. Now, if I have the memory accesses that

Why does GCC's ifstream >> double allocate so much memory?

感情迁移 提交于 2021-01-21 12:10:27
问题 I need to read a series of numbers from a space-separated human-readable file and do some math, but I've run into some truly bizarre memory behavior just reading the file. If I read the numbers and immediately discard them... #include <fstream> int main(int, char**) { std::ifstream ww15mgh("ww15mgh.grd"); double value; while (ww15mgh >> value); return 0; } My program allocates 59MB of memory according to valgrind, scaling linearly with respect to the size of the file: $ g++ stackoverflow.cpp

Linux Kernel code in memory check with sha256 sum

房东的猫 提交于 2021-01-21 11:45:28
问题 Is there a way of finding the loaded kernel code inside the memory? I mean the bootloader loads the kernel and executes it. The kernel extracts itself and start to initialize the hardware and runs init. As I understand the kernel is saved and loaded from the (b)zImage from disk. This unchanged code I want to find inside the memory of the system and check it. I have the following enhancement: Create a sha256 hash of the loaded kernel code and compare it to a defined value to audit the security

Create CSV in memory, email, and remove from memory

会有一股神秘感。 提交于 2021-01-20 19:40:37
问题 private function convert_to_csv($input_array, $output_file_name, $delimiter) { $temp_memory = fopen('php://memory','w'); foreach ($input_array as $line) { fputcsv($temp_memory, $line, $delimiter); } fseek($temp_memory, 0); header('Content-Type: application/csv'); header('Content-Disposition: attachement; filename="' . $output_file_name . '";'); fpassthru($temp_memory); } I use the above function to take an array of data, convert to CSV, and output to the browser. Two questions: Is the file

How can I get a Span<T> from a List<T> while avoiding needless copies?

爷,独闯天下 提交于 2021-01-20 16:26:56
问题 I have a List<T> containing some data. I would like to pass it to a function which accepts ReadOnlySpan<T> . List<T> items = GetListOfItems(); // ... void Consume<T>(ReadOnlySpan<T> buffer) // ... Consume(items??); In this particular instance T is byte but it doesn't really matter. I know I can use .ToArray() on the List, and the construct a span, e.g. Consume(new ReadOnlySpan<T>(items.ToArray())); However this creates a (seemingly) unneccessary copy of the items. Is there any way to get a

How can I get a Span<T> from a List<T> while avoiding needless copies?

偶尔善良 提交于 2021-01-20 16:26:54
问题 I have a List<T> containing some data. I would like to pass it to a function which accepts ReadOnlySpan<T> . List<T> items = GetListOfItems(); // ... void Consume<T>(ReadOnlySpan<T> buffer) // ... Consume(items??); In this particular instance T is byte but it doesn't really matter. I know I can use .ToArray() on the List, and the construct a span, e.g. Consume(new ReadOnlySpan<T>(items.ToArray())); However this creates a (seemingly) unneccessary copy of the items. Is there any way to get a

How can I get a Span<T> from a List<T> while avoiding needless copies?

人走茶凉 提交于 2021-01-20 16:25:23
问题 I have a List<T> containing some data. I would like to pass it to a function which accepts ReadOnlySpan<T> . List<T> items = GetListOfItems(); // ... void Consume<T>(ReadOnlySpan<T> buffer) // ... Consume(items??); In this particular instance T is byte but it doesn't really matter. I know I can use .ToArray() on the List, and the construct a span, e.g. Consume(new ReadOnlySpan<T>(items.ToArray())); However this creates a (seemingly) unneccessary copy of the items. Is there any way to get a