[prev in list] [next in list] [prev in thread] [next in thread] 

List:       hpux-cxx-dev
Subject:    Re: CXX-DEV: Memory leak in std::list
From:       Michael Spertus <mps () geodesic ! com>
Date:       2001-11-29 21:07:29
[Download RAW message or body]

At 02:45 PM 11/28/01 -0700, Martin Sebor wrote:
> Michael Spertus wrote:
> > 
> > Why don't you just use REMIDI (http://www.geodesic.com) to automatically correct \
> > the memory leak? Automatically protecting against memory leaks (along with other \
> > errors) in 3rd-party libraries is exactly the sort of problem it is designed to \
> > solve. I personally wouldn't deploy a program without it. DISCLOSURE: I work for \
> > Geodesic, but would say the same thing even if I didn't.
> 
> This is not a memory leak in the conventional sense. The memory is eventually
> reclaimed (when the object goes out of scope). List maintains its own buffer
> of nodes but the algorithm that it uses to determine whether it needs to grow
> it is flawed. Instead of recycling unused nodes it just adds new ones. Since
> the nodes are all linked and the memory gets eventually released there's no
> way to just free some without manipulating the pointers that connect them.
> Unless the tool you recommend is really smart I don't think it will help.

Our precise definition of a leak is that used by garbage collectors--inaccessible by \
a chain of pointers from the roots. We automatically recognize and reclaim such \
leaked objects. From your description, the example at hand is not a leak in this \
sense. Of course, protection against conventional memory leaks in the program and in \
3rd-party shared libraries remains generally beneficial. 

For the record, the memory errors automatically corrected by REMIDI are (1) Memory \
Leaks in the above sense (2) Short memory overwrites, i.e., "fencepost errors", (3) \
Double frees, (4) free/delete of non-heap objects, (5) premature frees, and (6) \
dangling reallocs. Furthermore, REMIDI replaces the system allocator by a much \
higher-performance, more scalable, parallelizing allocator, so programs typically run \
both safer and faster under REMIDI.

Mike


> Regards
> Martin
> _________________________________________________________________
> To leave this mailing list, send mail to majordomo@cxx.cup.hp.com
> with the message UNSUBSCRIBE cxx-dev
> _________________________________________________________________

 _________________________________________________________________
 To leave this mailing list, send mail to majordomo@cxx.cup.hp.com
    with the message UNSUBSCRIBE cxx-dev
 _________________________________________________________________


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic