[mod_python] Mod_Python not releasing memory?

Graham Dumpleton graham.dumpleton at gmail.com
Tue Aug 19 17:43:57 EDT 2008


2008/8/19  <Scott.Chapman at verizonwireless.com>:
>> In short though, in general once a process needs to allocate memory
>> from the operating system it is then marked as being in use by that
>> process for the life of the process, even if the individual memory
>> fragments are freed by code. Such freed memory can be reused within
>> the same process, but isn't released back to operating system for
>> other processes to use.
>
> If that were true, how would a processes memory usage ever spike and then go back down? I have seen this behavior plenty of times.

Because certain memory allocaters treat allocation of large memory
blocks that would require more memory in a special way and allocated
them at top of memory, If they are released straight away and no more
memory allocated from top of memory, it can actually give it back to
operating system. This is why I said 'in general' it is more
complicated but you shouldn't rely on such behaviour, especially when
talking about small Python objects.

Graham


More information about the Mod_python mailing list