A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-April/034579.html below:

[Python-Dev] Garbage collecting closures

[Python-Dev] Garbage collecting closuresJeremy Hylton jeremy@zope.com
14 Apr 2003 10:52:42 -0400
On Mon, 2003-04-14 at 10:34, Paul Prescod wrote:
> I don't know what the solution is, but it seems quite serious to me that 
>   there is another special case to remember when reasoning about when 
> destructors get called. Roughly, Python's cleanup model is "things get 
> destroyed when nothing refers to them." Then, that gets clarified to 
> "unless they have reference cycles, in which case they may get destroyed 
> arbitrarily later" and now "or they are used in a function containing 
> another function, which will cause a circular reference involving all 
> local variables."

The details of when finalizers are called is an implementation detail
rather than a language property.  You should add to your list of
worries: An object is not finalized when it is reachable from a cycle of
objects involving finalizers.  They don't get destroyed at all.

Finalizers seem useful in general, but I would still worry about any
specific program that managed critical resources using finalizers.

Jeremy







RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4