Python vs Java garbage collection?

"Martin v. Löwis" martin at v.loewis.de
Mon Dec 23 12:08:54 EST 2002


Robert Oschler wrote:
> I don't want to reiterate what's already been said on this thread so pardon
> the brief reply

Robert,

This won't be necessary, either, since I think I followed the thread 
closely. Your message surprised me since it appeared to be out of 
context. Before saying that it was indeed out of context, I hoped that 
you might want to elaborate a bit.

> but Python:__del__ and Java:finalize() cannot be relied
> upon to be called as soon as an object's reference count goes to 0, so they
> "have the feature" but not the call timing guarantee.  

No doubt about that (actually, there is doubt about with respect to 
CPython; this is the core of the current thread, but clearly not of your 
posting).

> In C++, using an auto_ptr example, the instant an object's reference 
> count goes to 0 it's destructor will be called.  

That is certainly also true.

However, I'm still curious as to what precisely the '"destructors 
please" issue' is that you have been pushing for quite some time, and 
what precisely it would mean to add destructors to Python and Java. I'm 
speaking as a language designer here, so I'm not too interested in how 
you would use the facility until I know what the facility is.

Regards,
Martin




More information about the Python-list mailing list