Why is this a mem leak?

Steve steve at hotmail.com
Thu Jul 22 18:50:02 EDT 2004


Hi,

I saw an article online 
(http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65333) where it 
explains how one can find out if there's a memory leak in ones program. 
How is there a memory leak in this:

     # make a leak
     l = []
     l.append(l)
     del l

??? Shouldn't deleting an object explicitly give the GC a better chance 
to find the object? Won't deleting it cause it's reference to go down 
(another question: which GC is python 2.3 using? Refcount or 
Generational?). Isn't 'del' similar to 'free'ing in C??

Thanks,

Steve




More information about the Python-list mailing list