[Python-Dev] Looking for master thesis ideas involving Python

Tim Peters tim.one at comcast.net
Sun Nov 2 21:48:42 EST 2003

[Martin v. Löwis, on schemes to segregate object memory by type, with
 the type pointer shared at a calculated address]
> ...
> So where do you put strings with 100,000 elements (characters)? Or any
> other object that exceeds an arena in size?

You allocate enough extra memory so that there's room to stick a type
pointer at the calculated address; or, IOW, it becomes a one-object pool but
of unusually large size.  Somes bytes may be lost at the start of the
allocated region to allow planting a type pointer at a pool-aligned address;
but by assumption the object is "very large", so the wastage can be small in
percentage terms.

That said, the current pymalloc is relentlessy about speeding alloc/free of
exactly-the-same-size small blocks -- there's not much code that could be
reused in a type-segregated scheme (the debug pymalloc wrapper is a
different story -- it can wrap any malloc/free).

More information about the Python-Dev mailing list