[Python-Dev] valgrind

Tim Peters tim.peters at gmail.com
Tue Nov 7 21:34:45 CET 2006

[Kristján V. Jónsson]
> ...
> Actually, obmalloc could be improved in this aspect.  Similar code that I once wrote
> computed the block base address, but than looked in its tables to see if it was
> actually a known block before accessing it.

Several such schemes were tried (based on, e.g., binary search and
splay trees), but discarded due to measurable sloth.  The overwhelming
advantage of the current scheme is that it does the check in constant
time, independent of how many distinct arenas (whether one or
thousands makes no difference) pymalloc is managing.

> That way you can have blocks that are larger than the virtual memory block
> of the process.

If you have a way to do the check in constant time, that would be
good.  Otherwise speed rules here.

More information about the Python-Dev mailing list