[Python-Dev] Debug entry points for PyMalloc

Tim Peters tim.one@comcast.net
Thu, 21 Mar 2002 14:57:38 -0500


[martin@v.loewis.de]
> I thought that the malloc hooks in pymalloc where precisely introduced
> for this kind of debugging. Just put the VC malloc hooks into
> _PyCore_ObjectMalloc_SetHooks, and enjoy the features you had been
> using all the time.

I disapprove of #define'ing WITH_MALLOC_HOOKS:  it slows every entry point
whether you're using hooks or not.  I'd like to remove the hook subsystem.
At a conceptual level, I'm not interested in building or maintainng a
perfectly general framework -- all I want to do is get a good debug
allocator for Python.  If someone wants a different one, edit the friggin'
source code -- IMO the hook system is just another YAGNI from Python's POV
(although it may make sense for a standalone allocator).

I'm not particularly interested in calling the MS debug malloc/realloc/free
anyway:  when memory corruption is suspected in a release build, switching
to a radically different allocator is depressingly likely to make the
problem disappear (one reason I want to be able to use a debug pymalloc even
in a release build).