[Python-Dev] gc ideas -- dynamic profiling

"Martin v. Löwis" martin at v.loewis.de
Sat Dec 4 00:21:52 CET 2010

> q1 are generations placed in separate memory regions, or are all
> generations in one memory regions and there is a pointer that
> signifies the boundary between generations?

You should really start reading the source code. See Modules/gcmodule.c.

To answer your question: neither, nor. All objects are in one region,
and there is no pointer separating the generations. Instead, all objects
belonging to one generation form a double-linked list.

> I propose to track hot spots in python, that is contexts where most of
> allocations occur, and instrument these with counters that essentially
> tell how often an object generated here ends up killed in ephemeral,
> short-, long-lived garbage collector run or is in fac tstill alive. If
> a particular allocation context creates objects that are likely to be
> long-lived, allocator could skip frst 2 generations altogether
> (generations are separate regions) or preload the object with high
> survival count (if q1 is single region).

We would consider such a proposal only if you had *actual evidence*
that it improves things, rather than just having a reasoning that it


More information about the Python-Dev mailing list