[Python-Dev] Re: DEBUG_SAVEALL feature for gc not in 2.0b1?
Fri, 1 Sep 2000 16:10:32 -0600
On Fri, Sep 01, 2000 at 11:47:59PM +0200, Vladimir Marangozov wrote:
> By putting them in gc.collected_garbage. The next collect() should be
> able to empty this list if the DEBUG_SAVEALL flag is not set. Do you
> see any problems with this?
I don't really see the point. If someone has set the SAVEALL flag then
they are obviously debugging a program. I don't see much point
in the GC cleaning up this garbage. The user can do it if they like.
I have an idea for an alternate interface. What if there was a
gc.handle_garbage hook which could be set to a function? The collector
would pass garbage objects to this function one at a time. If the
function returns true then it means that the garbage was handled and the
collector should not call tp_clear. These handlers could be chained
together like import hooks. The default handler would simply append to
the gc.garbage list. If a debugging flag was set then all found garbage
would be passed to this function rather than just uncollectable garbage.
Skip, would a hook like this be useful to you?