[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-readline] Memory leaks (identified with valgrind)
From: |
Chet Ramey |
Subject: |
Re: [Bug-readline] Memory leaks (identified with valgrind) |
Date: |
Sun, 6 Mar 2016 16:09:25 -0500 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 |
On 3/6/16 3:27 PM, John Darrington wrote:
> These are not leaks; this is simply allocated memory to which the
> application still has a handle when the program exits.
>
> This may well be true. But having these hanging around can mask other blocks
> of allocated memory which really are leaks.
That's why valgrind reports them separately.
> > I suggest that readline establish an "atexit" function during
> initialization
> > that will cleanup... or (less desirable) provide a suitable function
> > for the
> > application to call "atexit".
>
>
> In fact, a library which calls atexit is highly undesireable. The reason is,
> that if
> your program also calls atexit (or another library you're linking against
> does) then
> you have no control over which "atexit" payload gets called first.
That's now really how it would work in practice. If I implemented
something like this, it would be called something like rl_atexit and
it would be up to the application to register it.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU address@hidden http://cnswww.cns.cwru.edu/~chet/
signature.asc
Description: OpenPGP digital signature