Interest in generational GC for Python

  • Thread starter Borked Pseudo Mailed
  • Start date
B

Borked Pseudo Mailed

Hello,

Is there any interest in generational garbage collection in Python these days ?

Anyone working on it ?

Thanks
 
B

Benjamin Peterson

Hello,

Is there any interest in generational garbage
collection
in Python these days ?

Anyone working on it ?

The PyPy project has implemented more GC's than you want to
think about
including a ref counting gc, mark-sweep, and
several generational GCs and have
received excellent performance from them.
You should look at their new beta release.
 
M

Martin v. Löwis

Is there any interest in generational garbage collection in Python these days ?
Anyone working on it ?

This is the time machine at work: the garbage collector in CPython *is*
generational (with three generations).

Regards,
Martin
 
M

Martin v. Löwis

I'm lost there. Isn't CPython using reference counting (i.e updating the
object's state at each reference creation/deletion, and deleting the
objects as soon as they have no more references to them) ? It seemed to
me that generational GC only applied to periodic GCs, like tracing
garbage collectors. Or is CPython using a mix of both technologies (to
prevent cycles for example) ?

The latter, since Python 2.2. See Modules/gcmodule.c for implementation
details.

It can't really prevent cycles, but it can collect them once they become
garbage (and the garbage collector is triggered, in the right
generation). Objects not participating in cycles are released
immediately when they become unreachable.

Regards,
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top