Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Detecting Memory Leaks

   From: Jerry Feldman <gaf at>
   Date: Fri, 16 Jul 2004 07:30:19 -0400

   On Thu, 15 Jul 2004 18:04:00 -0400
   Josh Pollak <pardsbane at> wrote:

   > As someone else said on this list, its possible you don't have a
   > memory leak, but rather the program is allocating memory and just not 
   > deallocating it until much later. Also, as they said the memory might 
   > not be returned to the OS just because you deallocated it. 

   Most allocators never return memory back to the OS, and I am sure that
   this is true with glibc. 

I think glibc does, at least on Linux -- I've seen process sizes
shrink as well as grow.  However, it can only return full pages back
to the OS.  So if your application is fragmenting its heap, it may
become less and less able to return pages like this, even if it's not
actually leaking memory.

It's also possible that the application genuinely uses more memory
over time, without technically leaking memory.  A memory leak,
technically speaking, refers to memory which is not freed, but to
which there are no pointers (so that it cannot be accessed).  For
example, if it maintains a linked list to which it adds elements over
time, it wouldn't show up as a leak even though the process size would
be growing over time.

Robert Krawitz                                     <rlk at>

Tall Clubs International  -- or 1-888-IM-TALL-2
Member of the League for Programming Freedom -- mail lpf at
Project lead for Gimp Print   --

"Linux doesn't dictate how I work, I dictate how Linux works."
--Eric Crampton

BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!

Boston Linux & Unix /