Archive for the ‘Memory’ Category

Meaning of the SysRq-’m’ output

When you feel curious about what memory status is at some point, you can use SysRq facility. After enabling the sysrq featulre by execute following command, you just need to press ‘SysRq’ + ‘m’ or trigger the command. 1 echo 1 > /proc/sys/kernel/sysrq Above command enables the SysRq feature. To get memory status, you can [...]

How kernel determind the low and high memory zone?

I thought Linux fixed highmem zone and low mem zone at the compile time. But, I was wrong. I even found the command line parameter named ‘highmem=’ which can set the highmem size. Actually, this calculation is done during the initialization and following is the code which actually do the thing. 895/* 896 * Determine [...]

how linux get maximum pfn number?

I wondered where linux get information about memory capacity in the machine. In i386 machine, we can get information from BIOS or e820 which is shorthand for BIOS function name. You can find some information from whikipedia : http://en.wikipedia.org/wiki/E820 Anyway, after checking basic memory map information, kernel call following function to get max_pfn value. 868/* [...]

Why free() does not return allocated physical memory to the OS?

If your application have to fight with huge amount of memory resources, you will find this unexpected result sometimes. Even though you free()ed every memory into the Kernel, your process still holding that memory when you check with vmstat or free command. It can be act differently among different Linux distributions and different library set. [...]