Weird memory consumption problem.
Bo Peng
bpeng at rice.edu
Tue Dec 20 09:54:21 EST 2005
Bo Peng wrote:
>> Sorry, are you saying that the code you posted does NOT have a memory
>> leak, but you want us to find the memory leak in your real code sight
>> unseen?
Problem found. It is hidden in a utility function that converts the
return value to a double. The refcnt of the middle result was not
decreased.
PyObject* res = PyNumber_Float(obj);
val = PyFloat_AsDouble(res);
// missing
Py_DECREF(res);
The problem is not that difficult to find, but it was 2am in the morning
and I was misled by the different behavior of pyFun1 and pyFun2.
Thanks,
Bo
More information about the Python-list
mailing list