Re: Weird memory consumption problem.



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
.



Relevant Pages

  • Re: [PATCH 1/1] block: CFQ refcounting fix
    ... >>I ran across a memory leak related to the cfq scheduler. ... >>incrementing this refcnt, so I removed the refcnt increment and it fixed the ... To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ ...
    (Linux-Kernel)
  • [PATCH 1/1] block: CFQ refcounting fix
    ... I ran across a memory leak related to the cfq scheduler. ... init function increments the refcnt of the associated request_queue. ...
    (Linux-Kernel)
  • Re: Weird memory consumption problem.
    ... but you want us to find the memory leak in your real code sight unseen? ... I just can not figure out why val, readonly access to a tuple element, can cause this kind of problem. ... is there a way to list all or newly added python objects? ...
    (comp.lang.python)