memory leak in httpd or child process (what is a memory leak)

Andrej Marjan amarjan-e+AXbWqSrlAAvxtiuMwx3w at public.gmane.org
Tue Dec 20 20:42:22 UTC 2005


Robert Brockway wrote:

> On Tue, 20 Dec 2005, paul sutton wrote:
>
>> For the benefit of those who don't know what this is could someone 
>> please explain what a memory leak is.
>
>
> Hi Paul.  A memory leak is when a process consumes more memory than it 
> releases.  


That's only a partial definition of a leak -- it's perfectly reasonable 
for a process to allocate more memory than it releases, so long as it 
uses all that memory. What happens if the process tries to use more 
memory than is available is another question. :)

The thing that characterizes a memory leak is that the process stops 
using some of the memory that it has allocated, but fails to release it. 
That's the leak -- the bookkeeping fails, and the process loses track of 
some memory. The memory is not being used, but since the process doesn't 
know about it anymore, it can't release it back to the operating system.

As Robert suggests, the bookkeeping required is quite difficult for 
large programs, which is why so many people were excited about Java and 
other languages with garbage collectors. Garbage collectors essentially 
automate a lot of this stuff, making it much harder (but by no means 
impossible) to cause a memory leak.

--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list