memory usage

Jeff Shannon jeff at ccvcorp.com
Tue Apr 2 13:59:17 EST 2002


In article <mailman.1017604009.31777.python-list at python.org>, 
abou at cam.org says...
> Is there a specific way to clean the memory used by python scripts?
> While debugging my project, I always get a 'not enough memory to run
> this program' after running it a few times (Win98).

Unfortunately, this is probably a problem with the Windows memory 
manager, having nothing to do with Python.  Python does its own 
garbage collection, and once you've released all references to 
your objects (which should happen automatically when Python shuts 
down), all that memory is freed.  However, Python can't guarantee 
that the underlying memory manager will actually *do* anything 
with that freed memory.  

So, your options are:  1) Make sure that you're actually 
terminating each debugging session before trying to start a new 
one.  2) When this error happens, reboot Windows and then try 
again.  3)  Buy more memory -- it's cheap.  (I've never run out 
of memory, even when I only had 64MB, but then, I haven't been 
running many memory-intensive scripts.)  4) Use a different OS.  
The Win9x memory manager is particularly poor.  If you can 
upgrade to an NT-based Windows, you'll be much better off.  

-- 

Jeff Shannon
Technician/Programmer
Credit International



More information about the Python-list mailing list