how to "free" an object/var ?

Aahz aahz at pythoncraft.com
Wed Jan 31 12:40:40 EST 2007


In article <AAXvh.1465$zH1.1114 at newssvr29.news.prodigy.net>,
John Nagle  <nagle at animats.com> wrote:
>Steven D'Aprano wrote:
>> On Tue, 30 Jan 2007 15:48:37 -0800, James Stroud wrote:
>> 
>> 
>>>Stef Mientki wrote:
>>>
>>>>If I create a large array of data or class,
>>>>how do I destroy it (when not needed anymore) ?
>
>    If your data structure has no backlinks, it will go away
>as soon as the last reference to it disappears.  If your
>data structure has backlinks, it will hang around until
>garbage collection runs.  If your backlinks are
>weak references (see "weakref"), the data structure will
>be released much sooner.

Note that exceptions create links.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"I disrespectfully agree."  --SJM



More information about the Python-list mailing list