Overriding operator delete in a Python extension

Aahz aahz at pythoncraft.com
Sat Jan 17 14:09:43 EST 2004


In article <bubnvd$7v1$1 at pump1.york.ac.uk>,
Andrew Wilkinson  <ajw140NO at SPAM.york.ac.uk> wrote:
>
>I've written a C++ Python extension, and as part of it I override the
>operator new and operator delete functions to provide memory leak tracking
>from within the extension.
>
>When I use the code as part of a complete C++ program everything works
>perfectly, however when I compile it with my Python interface code the
>operator delete function is not called - the operator new function is
>called as normal however. I assume this is because the function is not
>linked correctly, but I'm at a loss for how to make the linker resolve the
>references in the .so file.
>
>Does anyone know a possible solution to my problem?

Use Boost.Python.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

A: No.
Q: Is top-posting okay?



More information about the Python-list mailing list