bug-ncurses
[Top][All Lists]
Advanced

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

Re: memory leak problems, I might be doing something wrong


From: Thomas Dickey
Subject: Re: memory leak problems, I might be doing something wrong
Date: Tue, 12 Dec 2006 17:03:52 -0500 (EST)

On Tue, 12 Dec 2006, chinlu chinawa wrote:

Hello list,

I've been using valgrind with an appl. I'm in
development of. After completely isolated my curses
module I find that or I'm doing something wrong or
there's some sort of problem with my system.

I'm using the last patched version of curses
(20061209), and I'm sending code to reproduce my
problem together with valgrind's output:

http://es.geocities.com/ucho_trabajo/curses/test.c.txt
http://es.geocities.com/ucho_trabajo/curses/valgrind.txt
http://es.geocities.com/ucho_trabajo/curses/valgrind_verbose.txt

That looks normal to me. Unless ncurses is configured with --disable-leaks, it retains some chunks of memory for performance reasons and some other chunks to make refresh() work after endwin(), etc.
ncurses will "always" have memory allocated.

If you configure ncurses (at build time of course) using --disable-leaks, it frees memory that it _can_ (making it slower), and provides an entrypoint for testing leaks in the remaining chunks: _nc_free_and_exit().

The C programs (progs and test) use this feature - ifdef'd - and I use that for testing, usually with valgrind. It's also useful for building
a test library, e.g., so I can factor out ncurses memory allocation from
analyzing other programs linked with it.  But since it makes the library
slower, it's not suitable for production use.

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net




reply via email to

[Prev in Thread] Current Thread [Next in Thread]