Apache Mod-Python - Re: memory leaks (was Re: Commented: (MODPYTHON-172) Memory leak with util.fieldstorag

This is Interesting: Free IT Magazines  
Home > Archive > Apache Mod-Python > July 2006 > Re: memory leaks (was Re: Commented: (MODPYTHON-172) Memory leak with util.fieldstorag





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Re: memory leaks (was Re: Commented: (MODPYTHON-172) Memory leak with util.fieldstorag
Harold Ship

2006-07-12, 7:11 pm

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();
}





Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com