![]() |
RE: GC time debug...
[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 often. > 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 gc.disable() Refcounting will continue to reclaim non-cyclic trash. Objects in unreachable cycles will leak. If you know you have some dead time, you can do gc.collect() 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. |
| All times are GMT. The time now is 08:09 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.