![](https://secure.gravatar.com/avatar/e79e2064f0ec68a0493ca5de758aeaa4.jpg?s=120&d=mm&r=g)
[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).