On Jul 2, 2009, at 9:28 PM, Gabriel Genellina wrote:

En Thu, 02 Jul 2009 14:22:53 -0300, Philip Semanchuk
<phi...@semanchuk.com> escribió:

Hi Shen,
I'm no expert on Python memory management, but since no once else has answered your question I'll tell you what I *think* is happening.

Python doesn't delete objects as soon as they're dereferenced.

Nope. CPython *does* destroy objects as soon as their reference count
reaches zero. It does not rely on garbage collection for that.

It merely marks them as safe for garbage collection (GC). If GC never happens (and it might not in a small test program), your dealloc function won't run.

The garbage collector is only used to recover memory from object cycles (in the CPython implementation; Jython *does* use garbage collection for
"normal" object destruction too)

Now some more knowledgeable person will probably correct me. =)

Wow, that last part was the only part I got right. =) Thanks for straightening me out, Gabriel.



--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to