You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Arnab Ganguly <ag...@gmail.com> on 2008/03/26 16:39:57 UTC

Query on deletion of Request pool

Hi All,
I am getting a serious memory issue with my Apache webserver.

Initially I was allocating buffer from by using apr_palloc from the request
pool assuming the allocated memory is going to be released but not sure what
is the problem the memory grows infinitely.

I then tried with own malloc and then added a  clean up function on
apr_pool_cleanup_run.Which on debugging showed the free is being called for
the allocated memory but still the behavior is same.On each request there is
a increase in memory.

Is there any way to release explicitly the memory of the request pool?I
tried with apr_pool_cleanup_register and added a clean up function
internally I was calling apr_pool_destroy(request_rec->pool).For the first
request it worked correctly but on the later there was a crash and restart
on the Apache process.

It seems I may be doing something silly.Any help would be very much
appreciated.BTW my webserver is heavily loaded and it is MPM=Worker Apache
version 2.2.8 and OS is Red-Hat 3.0.

What are the other possibilities where memory leak can looked into.
Looking forward for response.
Thanks
-A

Re: Query on deletion of Request pool

Posted by Arnab Ganguly <ag...@gmail.com>.
>It up to the OS to mark the freed areas as free or use it as a
>filesystem buffer or whatever buffer, as long as the memory isn't needed
>by applications.

Thanks for the update.Actually when I do top -p on the process id I do see
memory consumed by Apache is very less but over the time when I do free -m
the RAM gets reduced.I wonder can be this case happen free -m is 0 and the
machine will crash or something....I was thinking may be the Apache was
eating up the RAM.Please let me know your views on this.
Regards
-A


On Fri, Mar 28, 2008 at 2:31 PM, Robert Schulze <rs...@bytecamp.net> wrote:

> Hi,
>
> >> On Wed, Mar 26, 2008 at 10:51 PM, Arnab Ganguly <ag...@gmail.com>
> >> wrote:
> >>
> >>>  In the particular box only Apache is running no other application
> >> process is
> >>>  running.Also one more observation was when the Apache is stopped the
> >> free -m
> >>>  doesn't result to the original memory restore.We have to reboot the
> box
> >> to
> >>>  restore the original RAM.
>
> It up to the OS to mark the freed areas as free or use it as a
> filesystem buffer or whatever buffer, as long as the memory isn't needed
> by applications.
>
>
> with kind regards,
>
> Robert Schulze
>

Re: Query on deletion of Request pool

Posted by Robert Schulze <rs...@bytecamp.net>.
Hi,

>> On Wed, Mar 26, 2008 at 10:51 PM, Arnab Ganguly <ag...@gmail.com>
>> wrote:
>>
>>>  In the particular box only Apache is running no other application
>> process is
>>>  running.Also one more observation was when the Apache is stopped the
>> free -m
>>>  doesn't result to the original memory restore.We have to reboot the box
>> to
>>>  restore the original RAM.

It up to the OS to mark the freed areas as free or use it as a 
filesystem buffer or whatever buffer, as long as the memory isn't needed 
by applications.


with kind regards,

Robert Schulze

Re: Query on deletion of Request pool

Posted by Arnab Ganguly <ag...@gmail.com>.
>It sounds like you're tracking the wrong numbers if memory isn't free
>when the application terminates.


Not clear to me.Can you please add some more lights to it.
Thanks
A

On Thu, Mar 27, 2008 at 7:54 PM, Eric Covener <co...@gmail.com> wrote:

> On Wed, Mar 26, 2008 at 10:51 PM, Arnab Ganguly <ag...@gmail.com>
> wrote:
>
> >  In the particular box only Apache is running no other application
> process is
> >  running.Also one more observation was when the Apache is stopped the
> free -m
> >  doesn't result to the original memory restore.We have to reboot the box
> to
> >  restore the original RAM.Should I try using smaller value for
> MaxMemFree?
> >  Thanks and regards
> >  -A
>
>
>
> --
> Eric Covener
> covener@gmail.com
>

Re: Query on deletion of Request pool

Posted by Eric Covener <co...@gmail.com>.
On Wed, Mar 26, 2008 at 10:51 PM, Arnab Ganguly <ag...@gmail.com> wrote:

>  In the particular box only Apache is running no other application process is
>  running.Also one more observation was when the Apache is stopped the free -m
>  doesn't result to the original memory restore.We have to reboot the box to
>  restore the original RAM.Should I try using smaller value for MaxMemFree?
>  Thanks and regards
>  -A

It sounds like you're tracking the wrong numbers if memory isn't free
when the application terminates.


-- 
Eric Covener
covener@gmail.com

Re: Query on deletion of Request pool

Posted by Arnab Ganguly <ag...@gmail.com>.
Hi,
Thanks for the email.
I have tried using the MaxMemFree to 100 the with MaxRequestPerChild non
zero.The active process growth is around 15 MB but when I tried to free -m
or vmstat it always shows the memory it is reducing.The amount it gives back
to OS is much lesser than it occupies.

In the particular box only Apache is running no other application process is
running.Also one more observation was when the Apache is stopped the free -m
doesn't result to the original memory restore.We have to reboot the box to
restore the original RAM.Should I try using smaller value for MaxMemFree?
Thanks and regards
-A

On Wed, Mar 26, 2008 at 10:26 PM, Eric Covener <co...@gmail.com> wrote:

> On Wed, Mar 26, 2008 at 11:39 AM, Arnab Ganguly <ag...@gmail.com>
> wrote:
> > Hi All,
> >  I am getting a serious memory issue with my Apache webserver.
> >
> >  Initially I was allocating buffer from by using apr_palloc from the
> request
> >  pool assuming the allocated memory is going to be released but not sure
> what
> >  is the problem the memory grows infinitely.
>
> How are you measuring memory use?  Have you tried MaxMemFree?
>
> By default, apache won't continuously return this storage to the
> native heap because it's likely going to be needed again anyway.
>
> --
> Eric Covener
> covener@gmail.com
>

Re: Query on deletion of Request pool

Posted by Eric Covener <co...@gmail.com>.
On Wed, Mar 26, 2008 at 11:39 AM, Arnab Ganguly <ag...@gmail.com> wrote:
> Hi All,
>  I am getting a serious memory issue with my Apache webserver.
>
>  Initially I was allocating buffer from by using apr_palloc from the request
>  pool assuming the allocated memory is going to be released but not sure what
>  is the problem the memory grows infinitely.

How are you measuring memory use?  Have you tried MaxMemFree?

By default, apache won't continuously return this storage to the
native heap because it's likely going to be needed again anyway.

-- 
Eric Covener
covener@gmail.com