I have a C++ class with a method
virtual void setAutoTicks ( const std::string &, bool );
I wrote the ConvertToTypeCode this...
%ConvertToTypeCode
// Allow a Python string whenever a string is expected.
if (sipIsErr == NULL)
return PyString_Check(sipPy);
if (sipPy == Py_None) {
*sipCppPtr = NULL;
return 0;
}
if (PyString_Check(sipPy)) {
*sipCppPtr = new string(PyString_AS_STRING(sipPy));
return 0;
}
*sipCppPtr = (string *)sipForceConvertTo_std_string(sipPy,sipIsErr);
return 1;
%End
It works, but it leak memory. One of my users used the method in a
loop so it was called 200,000 times and he reported it leaked about
250 bytes per iteration. Taking out the string argument and
re-running his test case, showed no leak at all.
Any ideas?
_______________________________________________
PyKDE mailing list [EMAIL PROTECTED]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde