[Python-Dev] gc ideas -- sparse memory

Cameron Simpson cs at zip.com.au
Sat Dec 4 05:06:45 CET 2010


On 03Dec2010 18:15, James Y Knight <foom at fuhm.net> wrote:
| On Dec 3, 2010, at 6:04 PM, Terry Reedy wrote:
| > gc is implementation specific. CPython uses ref counting + cycle
| > gc. A constraint on all implementations is that objects have a fixed,
| > unique id during their lifetime. CPython uses the address as the id, so
| > it cannot move objects. Other implementations do differently. Compacting
| > gc requires an id to current address table or something.
| 
| It's somewhat unfortuante that python has this constraint, instead of
| the looser: "objects have a fixed id during their lifetime", which is
| much easier to implement, and practically as useful.

Python doesn't have the constraint you imagine; it _does_ have "objects
have a fixed id during their lifetime".

_CPython_ has this constraint because it uses the address as the id,
which is free and needs no papping or extra storage. Of course, it
removes certain freedoms from the GC etc as a side effect.
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

The number of cylinders for this disk is set to 364737.
There is nothing wrong with that, but this is larger than 1024, [...]
- fdisk on our new RAID 07oct2007 :-)


More information about the Python-Dev mailing list