Memory management

Michael Hudson mwh21 at cam.ac.uk
Tue Jul 25 17:41:17 EDT 2000


"Larry Whitley" <ldw at us.ibm.com> writes:

> Reading through Quick Python.  For those who want to get explicit about
> memory management, it looks like the authors advise saying "object = None"
> rather than "del object".  Is that the correct interpretation?  

For this purpose, they have the same effect.

> Presumably Python will then call object.__del__() when the garbage
> collector runs.

... sorry, parsing failure here ... 
Python calls object.__del__ *when* object's refcount hits zero; if
you're talking about the maybe-in-2.0 garbage collector, then I
believe the answer is "it depends" - I'm not sure what on, but it's a
tricky area.

Cheers,
M.

-- 
  Programming languages should be designed not by piling feature on
  top of  feature, but by removing the  weaknesses and restrictions
  that make the additional features appear necessary.
               -- Revised(5) Report on the Algorithmic Language Scheme



More information about the Python-list mailing list