[Python-Dev] gc ideas -- sparse memory
Terry Reedy
tjreedy at udel.edu
Sat Dec 4 01:05:19 CET 2010
On 12/3/2010 6:15 PM, James Y Knight 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.
I left out that the id must be an int.
> 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.
Given that the only different between 'fixed and unique' and 'fixed' is
the uniqueness part, I do not understand 'practically as useful'.
Duplicate ids (in the extreme, that same for all objects) hardly seem
useful at all.
--
Terry Jan Reedy
More information about the Python-Dev
mailing list