quetz-mod_python-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Harold Ship <har...@giant-steps-networks.com>
Subject Re: memory leaks (was Re: Commented: (MODPYTHON-172) Memory leak with util.fieldstorage using mod_python 3.2.8 on apache 2.0.55)
Date Wed, 12 Jul 2006 19:18:25 GMT
Jim Gallacher <jpg <at> jgassociates.ca> writes:

> 
> I've run some tests to evaluate the memory leaks. The tests are brute
> force - make requests and watch the memory changes with top -b.
>
 
...

> First up - our leaky 3.2.9, and man does it leak! The readlines request
> has a body of 1M bytes, and it fails in a hurry.
> 

...

> Everything is looking much better, with readlines looking very stable.
> Cfgtree_walk and parse_qsl are also looking much better but there may
> still be a problem. To confirm this I ran the tests against 3.2.x build
> 20060709 again, but with 100,000 requests.
> 

Did you have a chance to re-run the tests?

There are some things I've found, although I don't think they cause a leak.
For example, in parse_qs() there is:

        pair = PyString_FromStringAndSize(NULL, len);
        if (pair == NULL)
            return NULL;

this should be:

        pair = PyString_FromStringAndSize(NULL, len);
        if (pair == NULL) {
            Py_DECREF(pairs);
            return NULL;
        }

There are a few more like that in parse_qs() and parse_qsl(), and cfgtree_walk().

In req_readlines(), line 810/811 the intention isn't clear of:

    if (result == NULL)
        return PyErr_NoMemory();

While the exact same code on lines 814/815 are not correct.
They should be:

    if (rlargs == NULL) {     // note rlargs not result
        Py_DECREF(result);
        return PyErr_NoMemory();
    }





Mime
View raw message