[reportlab-users] Memory Leak in rl_accel.c

reportlab-users@reportlab.com reportlab-users@reportlab.com
Mon, 7 Apr 2003 18:45:18 +0200


Hello,

While trying to embed the PDF generator into our application, I noticed
a slow increase of the memory usage: approx. 15Mb for 1000 pages,
even after the documents are saved and closed.

Investigations showed that there is a memory leak in the
fp_str function which is rewritten in C,
in the rl_accel.c source.

I am not a Python/C API expert, but on line 470:
        if((pD=PyNumber_Float(pD))) d = PyFloat_AS_DOUBLE(pD);
PyNumber_Float returns a new reference which lacks a Py_DECREF,
which I simply add some lines later.
This seems to correct the problem.

Has someone noticed this before?
What is the process to correct this problem?

--
Amaury Forgeot d'Arc