2 ms·
Python uses a similar trick in its internal allocater (pymalloc) [1]. Given a memory address, pymalloc determines if it controls it by computing what would be t
by gizmo686 12y ago
Python uses a similar trick in its internal allocater (pymalloc) [1]. Given a memory address, pymalloc determines if it controls it by computing what would be the base of the arena containing said address. It then finds the index of the arena (or trash) at a constant offset from the base. It then uses the index to check a vector of all the arenas that it controls.
[1]http://svn.python.org/projects/python/trunk/Misc/README.valgrind http://svn.python.org/projects/python/trunk/Misc/README.valg...