[Python-Dev] GC pauses in CPython

Maciej Fijalkowski fijall at gmail.com
Mon Oct 14 14:44:07 CEST 2013


On Mon, Oct 14, 2013 at 2:42 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> Le Mon, 14 Oct 2013 14:38:44 +0200,
> Maciej Fijalkowski <fijall at gmail.com> a écrit :
>
>> On Mon, Oct 14, 2013 at 2:34 PM, Antoine Pitrou <solipsis at pitrou.net>
>> wrote:
>> > Le Mon, 14 Oct 2013 14:25:18 +0200,
>> > Maciej Fijalkowski <fijall at gmail.com> a écrit :
>> >> On Mon, Oct 14, 2013 at 2:11 PM, "Martin v. Löwis"
>> >> <martin at v.loewis.de> wrote:
>> >> > Am 14.10.13 13:49, schrieb Maciej Fijalkowski:
>> >> >> I'm working on an incremental GC for PyPy. How do I measure GC
>> >> >> pauses in CPython? (that is, the circular reference searching
>> >> >> stuff)
>> >> >
>> >> > I would instrument the interpreter. The tricky part may be to
>> >> > subtract the time for any resulting finalization (and whether or
>> >> > not to subtract that at all).
>> >> >
>> >> > Regards,
>> >> > Martin
>> >> >
>> >>
>> >> seems that:
>> >>
>> >> gc.set_debug(gc.DEBUG_STATS) does the job
>> >>
>> >> obviously timing gc.collect is quite the opposite of what I'm
>> >> trying to achieve (see how cpython deals with when to collect)
>> >
>> > Why "the opposite"? The time of a GC pause in CPython is the time
>> > executing gc.collect(). And most of the time gc.collect() will spend
>> > its time walking live objects, not dead ones, so executing it
>> > multiple times should only introduce a minor bias.
>>
>> well, I'm not trying to measure it at *one point in time* but to
>> provide some statistics. invoking it kills the point quite a bit.
>
> Ah, then you can plug into the new "callbacks" property:
> http://docs.python.org/3.3/library/gc.html#gc.callbacks
>
> Regards
>
> Antoine.

New in version 3.3.

no, thanks


More information about the Python-Dev mailing list