[Baypiggies] What garbage!
Aahz
aahz at pythoncraft.com
Fri Feb 16 23:14:21 CET 2007
On Thu, Feb 15, 2007, Dennis Reinhardt wrote:
> At 02:21 PM 2/15/2007, Chad Netzer wrote:
>>
>>Dennis, you said in your example, "The final time.sleep(2000) is to
>>allow time for garbage collection to reduce memory usage." However,
>>that certainly will have no effect with CPython, nor do operating
>>system memory allocators work that way.
>
> I read at http://docs.python.org/lib/module-gc.html where it says
>
> "tune the collection frequency"
>
> and other statements on this page to mean that the garbage collector makes
> periodic sweeps of object references. I do not see what the timing is. I
> did provide for a window in this code so that if such a sweep resulted in
> lowering memory requirements, I had provided for time to go by.
Generally speaking, GC runs depend on object allocation/de-allocation,
not clock time. GC will run when X number of objects have been created
without deallocating them. (There are some subtleties involved, but
that's the essence.) As Chad pointed out, this is separate from Python's
regular refcount mechanism.
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
"I disrespectfully agree." --SJM
More information about the Baypiggies
mailing list