call policies help needed
hi. I am trying to wrap a method that returns a new object (allocated with new)). As far as I know, I have to use the return_value_policy<manage_new_object>() construct, to tell the wrapper to hold that pointer. The wrapper compiles ok, but when I call that method (from python) I get an error (from glib) and the python interpreter exits. What am I missing? The error I am getting is: *** glibc detected *** malloc(): memory corruption: Abort Thanks, Ricardo Kirkner
Ricardo Kirkner <ricardokirkner@gmail.com> writes:
hi. I am trying to wrap a method that returns a new object (allocated with new)). As far as I know, I have to use the return_value_policy<manage_new_object>() construct, to tell the wrapper to hold that pointer.
The wrapper compiles ok, but when I call that method (from python) I get an error (from glib) and the python interpreter exits. What am I missing?
It's unclear. Are you *certain* this object was allocated with new? If that's the case, I can't imagine that the problem is coming from that particular wrapped function. My advice (as usual) is to reduce your program to the simplest possible case that still exhibits the problem. That almost always immediately reveals the problem. I hear utilities like valgrind can be really useful for situations like this, too, though I've never used it myself. -- Dave Abrahams Boost Consulting www.boost-consulting.com
participants (2)
-
David Abrahams -
Ricardo Kirkner