[Python-Dev] valgrind

Tim Peters tim.peters at gmail.com
Tue Nov 7 22:01:01 CET 2006


[Martin v. Löwis]

Thanks for explaining all this!  One counterpoint:

> Notice that on a system with limited memory, you probably don't
> want to use obmalloc, even if it worked. obmalloc uses arenas
> of 256kiB, which might be expensive on the target system.

OTOH, Python allocates a lot of small objects, and one of the reasons
for obmalloc's existence is that it typically uses memory more
efficiently (less bookkeeping space overhead and less fragmentation)
for mounds of small objects than the all-purpose system malloc.

In a current (trunk) debug build, simply starting Python hits an arena
highwater mark of 9, and doing "python -S" instead hits a highwater
mark of 2.  Given how much memory Python needs to do nothing ;-), it's
doubtful that the system malloc would be doing better.


More information about the Python-Dev mailing list