Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > RE: GC time debug...

Thread Tools

RE: GC time debug...

Tim Peters
Posts: n/a
[David Jeske]
> ...
> I wanted to know if it is acceptable to use Python's GC or not for
> this application. Pause times under 0.2s are non-ideal but
> acceptable. Longer than 0.2s isn't acceptable.

Python's GC is a hybrid scheme, and still uses refcounting for the vast bulk
of garbage collection in the vast bulk of applications. A mark-sweep
variant is invoked from time to time only to reclaim unreachable cycles
(which refcounting can't touch). The time for this is roughly proportional
to the number of live container objects plus the number of objects they
contain. A generational scheme is also in play, so that as containers
survive collections, they're moved into older generations examined less

> If I have a cycle, I'd rather leak the memory and let it clean up with
> the apache process dies and reforks().

Then you can begin your program with:

import gc

Refcounting will continue to reclaim non-cyclic trash. Objects in
unreachable cycles will leak. If you know you have some dead time, you can


to force a collection.

Of course this can't guarantee you'll never see long pauses either, since,
e.g., a long linear chain of trash objects can take an arbitrarily long time
to reclaim when the refcount on the chain's head falls to zero.

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is time.time() < time.time() always true? flamesrock Python 8 11-24-2006 06:51 AM
Re: interpreting the fractional portion of time.clock() vs time.time(0measurements Peter Hansen Python 0 02-22-2006 02:02 PM
Re: interpreting the fractional portion of time.clock() vs time.time()measurements Peter Hansen Python 0 02-22-2006 12:03 AM
time.clock() or time.time() Python 8 08-05-2005 01:51 PM
delta time = time stop - time start engsol Python 2 01-26-2004 12:06 PM