Python 2.0

Jeremy Hylton jeremy at cnri.reston.va.us
Thu Jun 3 11:13:55 EDT 1999


>>>>> "DC" == Donn Cave <donn at u.washington.edu> writes:

  DC> Does JPython use reference counts, and invoke delete methods as
  DC> soon as reference count drops to 0?

No.  It relies on Java to do memory management.  And even that doesn't 
always work as expected :-).  I was going to show you the example from 
the Python FAQ, where files are opened in a loop and implicitly closed 
when the reference disappears.  That won't happen in JPython, because
the finalization isn't guaranteed to happen.

But I got a completely different error:

JPython 1.0.3 on java1.2
Copyright 1997-1998 Corporation for National Research Initiatives
>>> import os
>>> for file in os.listdir("."):
...     f = open(file)
...     buf = f.read()
... 
Out of Memory
You might want to try the -mx flag to increase heap size

Sheesh!  And people want to use Java as the sole platform for Python
<0.5 wink>.

Jeremy




More information about the Python-list mailing list