Python vs Java garbage collection?

"Martin v. Löwis" martin at v.loewis.de
Sat Dec 21 17:12:57 EST 2002


John Roth wrote:
> The differences depend on the Java version you're using. Java
> versions through 1.2 used a garbage collector that didn't collect
> unreferenced objects until virtual memory filled up, which let it take
> quite a while before an instance's cleanup actions might be executed.

In addition, Java's garbage collection used to be conservative, which 
did lead to cases where it would not find certain garbage objects. This 
is now supposedly fixed; they call it a "precise" collector. Python's 
cyclic collector has been precise from the beginning (of course, there 
wasn't a cyclic collector in Python's beginning).

There are a few cases where you can exhaust memory without triggering 
collection early enough, but those are rare; in those cases, 
applications should tune the collector. There are also cases where 
collection takes an incredible amount of time, but they are also rare - 
there is some hope that a certain class of these cases can be eliminated 
by improving the GC scheme in Python.

Regards,
Martin




More information about the Python-list mailing list