Wednesday, February 17, 2010

A lesson in UNIX memory

When a process on UNIX needs memory, it is malloc’d. The process will grow in size. When the process is finished using that memory it will free the memory. This free memory is added to a free list for the running process. The footprint (size) of the process remains the same and does not decrease. This is a design in UNIX memory managers. Note that Windows servers will cause the memory footprint to decrease. On UNIX, the process now may require memory again. UNIX will use up the memory from the free list and the process will not grow. If the process does not have a segment of memory that is large enough for the new malloc, it will require more memory from the OS and the footprint will grow. When the memory is no longer needed, a free will return that memory to the free list within the process, but the process does not decrease. The OS vendor may have information on memory malloc and free or memory fragmentation that may help explain it.

For More information

http://developers.sun.com/solaris/articles/solaris_memory.html

No comments:

Post a Comment