Re: [Python-Dev] Proposal: Run GC less often

2008-06-22 Thread Terry Reedy
Neil Schemenauer wrote: BTW, I suspect that documentation needs updating since I understand that the GC is no longer optional (the stdlib and/or the Python internals create reference cycles themselves). Is it possible and might it be useful for those internal cycle-creating operations to in

Re: [Python-Dev] Proposal: Run GC less often

2008-06-22 Thread Martin v. Löwis
>>> Wouldn't it be simpler just to base the collection frequency >>> directly on the total number of objects in the heap? >> >> Using what precise formula? > > The simplest thing to try would be > > middle_collections >= num_objects_in_heap * some_constant So what value is some_constant? Regar

Re: [Python-Dev] Proposal: Run GC less often

2008-06-22 Thread Greg Ewing
Martin v. Löwis wrote: Wouldn't it be simpler just to base the collection frequency directly on the total number of objects in the heap? Using what precise formula? The simplest thing to try would be middle_collections >= num_objects_in_heap * some_constant -- Greg ___

Re: [Python-Dev] Proposal: Run GC less often

2008-06-22 Thread Martin v. Löwis
> Another problem is that the program could be slowly leaking and a > full collection will never happen. I don't think that will be possible. If the program slowly leaks, survivor objects leave the middle generation, and account towards the 10%. As the count of objects in the oldest generation doe

Re: [Python-Dev] Proposal: Run GC less often

2008-06-22 Thread Neil Schemenauer
Greg Ewing <[EMAIL PROTECTED]> wrote: > Martin v. Löwis wrote: > >> Under my proposal, 10 middle collections must have passed, >> PLUS the number of survivor objects from the middle generation >> must exceed 10% of the number of objects in the oldest >> generation. > > What happens if the program e

Re: [Python-Dev] Proposal: Run GC less often

2008-06-22 Thread Antoine Pitrou
Greg Ewing canterbury.ac.nz> writes: > > What happens if the program enters a phase where it's not > producing any new cyclic garbage, but is breaking references > among the old objects in such a way that cycles of them > are being left behind? Under this rule, the oldest > generation would never

Re: [Python-Dev] Proposal: Run GC less often

2008-06-21 Thread Martin v. Löwis
> What happens if the program enters a phase where it's not > producing any new cyclic garbage, but is breaking references > among the old objects in such a way that cycles of them > are being left behind? Under this rule, the oldest > generation would never be scanned, so those cycles would > neve

Re: [Python-Dev] Proposal: Run GC less often

2008-06-21 Thread Greg Ewing
Martin v. Löwis wrote: Under my proposal, 10 middle collections must have passed, PLUS the number of survivor objects from the middle generation must exceed 10% of the number of objects in the oldest generation. What happens if the program enters a phase where it's not producing any new cyclic

Re: [Python-Dev] Proposal: Run GC less often

2008-06-21 Thread Leif Walsh
If you can get me a version of the interpreter with this change made (I wouldn't know what to change), I can run a very allocation/deallocation-heavy application I have lying around, and get you some good benchmarks. On Sat, Jun 21, 2008 at 1:23 PM, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: - S

Re: [Python-Dev] Proposal: Run GC less often

2008-06-21 Thread Brett Cannon
On Sat, Jun 21, 2008 at 1:23 PM, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote: > Here is my proposal for making the GC run less often. > The objective is to avoid the quadratic-time behavior > if many objects are created and none of them is garbage. > [SNIP] > Applications with a small number of obj