Re: [Python-Dev] Issue 2722

2008-06-22 Thread Facundo Batista
2008/6/21 Neil Muller <[EMAIL PROTECTED]>: > Could some one have a look at the suggested fix for issue 2722? While > not a particularly common problem, it can be an annoyance, and the > patch looks reasonable. I'm on it... Python Bug Day! -- . Facundo Blog: http://www.taniquetil.com.ar/plog/ P

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-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

[Python-Dev] forceful exit

2008-06-22 Thread tomer filiba
hi i'm having trouble when forking child processes to serve sockets. the skeleton is something like the following: def work(): try: while True: s = listener.accept()[0] log("hello %s", s) if os.fork() == 0: try: s

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] C API for gc.enable() and gc.disable()

2008-06-22 Thread Tim Peters
[Antoine Pitrou] >> Would it be helpful if the GC was informed of memory growth by the >> Python memory allocator (that is, each time it either asks or gives back >> a block of memory to the system allocator) ? [Martin v. Löwis] > I don't see how. The garbage collector is already informed about me

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
>>> 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] C API for gc.enable() and gc.disable()

2008-06-22 Thread Martin v. Löwis
> pymalloc needing to allocate a new arena would be a different way to > track an excess of allocations over deallocations, and in some ways > more sensible (since it would reflect an excess of /bytes/ allocated > over bytes freed, rather than an excess in the counts of objects > allocated-over-fre

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