From fb31765cbe33890f325a87015507364156741321 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 19:59:44 +0200 Subject: Adding upstream version 42.0. Signed-off-by: Daniel Baumann --- help/C/memory-map-what.page | 79 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 help/C/memory-map-what.page (limited to 'help/C/memory-map-what.page') diff --git a/help/C/memory-map-what.page b/help/C/memory-map-what.page new file mode 100644 index 0000000..73bd0bd --- /dev/null +++ b/help/C/memory-map-what.page @@ -0,0 +1,79 @@ + + + + + + + + + + Phil Bull + philbull@gmail.com + 2011 + + + + Michael Hill + mdhillca@gmail.com + 2011, 2014 + + + The memory map of a process can help diagnose certain memory + issues. + + + What is a memory map? + + + Phil Bull +

Difficult conceptual topic. Explain how to use memory maps to do + whatever the hell you're supposed to use them for.

+
+ + + Kat +

TODO: check gui tags.

+
+ +

Virtual memory is a representation of the combined + physical memory and swap space in a + system. It enables running processes to access more than the + existing physical memory by mapping locations in physical memory + to files on disk.

+ +

When a program is launched, the system assigns it a unique process ID + (PID) and its instructions and data are loaded into memory + in pages. The page table of each process maps the correspondence + between its pages in virtual memory and their location in physical memory. + The memory map displays the total virtual memory use of the + process, and can be used to determine the memory cost of running a single or + multiple instances of the program, to ensure the use of the correct shared + libraries, to see the results of adjusting various performance tuning + parameters the program may have, or to diagnose issues such as memory + leaks.

+ +

If multiple copies of a program are running, the instructions (or + text) of the program only need to be loaded once into physical + memory. Each time a new instance of the program is launched (as a unique + process with its own virtual memory pages), its page table maps the location + of the text in virtual memory to those instructions in the original real + memory location. In addition, any dynamic shared libraries used by the + process appear as distinct in virtual memory, but are shared references to a + single copy of the library's text segment in real memory. When accounting for + the total memory use of a process, it is important to note that the cost of + shared libraries loaded into memory can be spread across all processes + currently using them.

+ +

When the system needs more pages of memory than are available, some of the + existing pages will be paged out or written to the swap + space. Text pages are flagged read-execute in memory and don't need to + be written to swap since they can be re-loaded from their original location + on disk. Data pages have read-write permissions, and if modified when in + memory, they are labeled dirty, and when designated for swapping, + must be paged out. When a page in swap space is required by a running + process, it needs to be swapped back in before use, perhaps causing another + page to be paged out.

+ +
-- cgit v1.2.3