[Python-Dev] Big trouble in CVS Python

Tim Peters tim.one@comcast.net
Mon, 14 Apr 2003 16:38:39 -0400


[Michael Hudson]
> It seems to me that this would have been found much more easily if
> floats didn't have a free list anymore...

Hard to guess.  It appears that the prematurely released float storage
wasn't allocated again by the time the error occurred, so if floats used
pymalloc a debug run would have sprayed 0xdb bytes into the memory, and that
would have made it obvious that the memory had been freed.  OTOH, if another
float object had gotten allocated between the premature-free and the error,
pymalloc and the free-list strategy are both likely to have handed out the
same storage again, and we'd be staring at the same symptoms either way.

It's hard to love the unbounded & immortal free list for floats regardless.
OTOH, I have no doubt that it *is* faster than pymalloc (the latter has more
overheads due to recycling whole pools when possible, and for determining
who (pymalloc or system malloc) owns the memory getting freed; invoking
pymalloc is also another layer of function call).