You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-dev@quetz.apache.org by Harold Ship <ha...@giant-steps-networks.com> on 2006/07/06 22:05:06 UTC

Re: Commented: (MODPYTHON-172) Memory leak with util.fieldstorage using mod_python 3.2.8 on apache 2.0.55

Hi Nicolas

Howcome I didn't see this post in JIRA? I added my comment there. I also didn't
get email. I just found it in Google.

Anyway, I have an application that was started over a year ago with 3.1.3. We 
switched to 3.2.8 because we had a requirement to upload files and there was a
problem that was fixed in that version.

I observed a memory leak in our application under 3.2.8, and found MODPYTHON-172
on Google. I ran the test program in my first comment on 3.2.8, then tried going
back to 3.1.3 to see if the leak was there too.

This leak seems to be in both 3.1.3 and 3.2.8.

I have added another comment regarding _apachemodule.c, which I include below.

Thanks for your help,
Harold



### ============ Begin Code ==============
Excuse me if this is a dumb question, but I don't know anything about the
Python-C interface.

Is it possible that the code in line 319 of _apachemodule.c (from 3.2.8) is the
problem?

The code is:

            if (key && val)
                PyList_Append(pairs, Py_BuildValue("(O,O)", key, val));

Does the object returned by Py_BuildValue() need to be dereferenced?
Something like:

            if (key && val) {
                PyObject * list_elem = Py_BuildValue("(O,O)", key, val);
                if (list_elem)
                    PyList_Append(pairs, list_elem);
                Py_XDECREF(list_elem);
            }

========================================