Overriding operator delete in a Python extension

A

Andrew Wilkinson

Hi,

This is probably more of a gcc question than a python one, but hopefully
someone out their will know that answer.

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?
Regards,
Andrew Wilkinson
 
A

Aahz

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,175
Messages
2,570,946
Members
47,497
Latest member
PilarLumpk

Latest Threads

Top