Set x to to None and del x doesn't release memory in python 2.7.1 (HPUX 11.23, ia64)
davea at davea.name
Wed Mar 6 14:25:34 CET 2013
On 03/06/2013 07:31 AM, Wong Wah Meng-R32813 wrote:
> Apologies as after I have left the group for a while I have forgotten how not to post a question on top of another question. Very sorry and appreciate your replies.
> I tried explicitly calling gc.collect() and didn't manage to see the memory footprint reduced. I probably haven't left the process idle long enough to see the internal garbage collection takes place but I will leave it idle for more than 8 hours and check again. Thanks!
You're top-posting, which makes things very confusing, since your
contribution to the message is out of accepted order. Put your remarks
after the part you're commenting on, and delete anything following your
message, as it clearly didn't need your comments.
Once you've called gc.collect(), there's no point in waiting 8 hours for
it to run again. It either triggered the C runtime's logic or it
didn't, and running it again won't help unless in the meantime you
rearranged the remaining allocated blocks.
Accept the fact that not all freeing of memory blocks can possibly make
it through to the OS. If they did, we'd have a minimum object size of
at least 4k on the Pentium, and larger on some other processors. We'd
also have performance that would crawl. So an external tool can only
give you a very approximate size for what's going on in your own code.
More information about the Python-list