On Aug 15, 2007, at 4:06 PM, Brant Faircloth wrote:
[...] The memory is only released upon restarting the program. [...] My question boils down to whether or not this is the desired/ expected behavior?
It is expected, yes.
I have not looked at how libmalloc (or whatever) works, but it seems that when an application allocates memory, it asks the system for some pages, it will manage these pages itself from then on, and if it needs more, it will ask the system for more pages, but it will never give them back.
Since the OS can track page usage, it will swap out pages which hasn’t been used for a while (when the OS runs out of memory), effectively taking back pages from the process, but in practice the page still belongs to the process.
So the reported memory for a process is often its peak usage.
An exception is made e.g. for mmap().
Take the above with a grain of salt, it’s based only on observation (though not of TM alone).