[Python-Dev] Activating pymalloc

Martin v. Loewis martin@v.loewis.de
15 Mar 2002 21:18:50 +0100


Tim Peters <tim.one@comcast.net> writes:

> calling malloc/free even when pymalloc is enabled.  Anyone think
> they know a reason (other than theoretical purity <wink>) for why
> pymalloc only targets the PyObject family?

I think the original rationale is that it does not really pay to
allocate other things with the object allocator: a pool allocator is
really good if you have many equal-sized object, but may waste a lot
of memory if you use it to manage arbitrary-sized memory blocks.

Also, for "large" requests, it forwards to system malloc. In the
current configuration, "large" requests are those larger than 64
bytes. If obmalloc would be used for all Python allocation requests,
it would need to forward to malloc much more often; this may be
undesirable and will certainly slow allocations for large chunks.

OTOH, I wonder whether the 64 byte limit is a bit small.

Regards,
Martin