Re: how to "free" an object/var ?



In article <AAXvh.1465$zH1.1114@xxxxxxxxxxxxxxxxxxxxxxxxxx>,
John Nagle <nagle@xxxxxxxxxxx> 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@xxxxxxxxxxxxxxx) <*> http://www.pythoncraft.com/

"I disrespectfully agree." --SJM
.



Relevant Pages

  • Re: Deeper copy than deepcopy
    ... The list-comprehension approach should work in my case ... as I know a priori that my data structure is finite. ... function -- even if it comes with the caveat that it will explode if ... given a data structure with backlinks. ...
    (comp.lang.python)
  • Re: Java and Large Applications
    ... > pointers in Swing. ... > which the popup menu is created until another popup menu is created in ... You could consider doing it yourself, perhaps using weak references. ... wrapper around the enormous data structure that would allow you to explicitly remove the ...
    (comp.lang.java.programmer)