On Sat, Aug 02, 2008 at 07:46:49PM -0400, Thomas Dickey wrote:
On Sat, 2 Aug 2008, brian m. carlson wrote:

Package: libncurses5
Version: 5.6+20080713-1
Severity: normal

According to valgrind, libncurses5 allocates approximately 118k that is
never freed:

from INSTALL:

    --disable-leaks
        For testing, compile-in code that frees memory that normally would not
        be freed, to simplify analysis of memory-leaks.

        Any implementation of curses must not free the memory associated with
        a screen, since (even after calling endwin()), it must be available
        for use in the next call to refresh().  There are also chunks of
        memory held for performance reasons.  That makes it hard to analyze
        curses applications for memory leaks.  To work around this, build
        a debugging version of the ncurses library which frees those chunks
        which it can, and provides the _nc_free_and_exit() function to free
        the remainder on exit.  The ncurses utility and test programs use this
        feature, e.g., via the ExitProgram() macro.

This isn't really a solution unless the libncurses5 package is built
with it.  It's great that you considered this problem and built in an
option to fix it, but it's not compiled into the Debian package, and so
the Debian package leaks memory.  Shared libraries aren't supposed to do
that.

I personally don't believe refresh is required to work after a
delwin(stdscr), since

  Calling delwin deletes the named window, freeing all memory associated
  with it....

except that it doesn't free all the memory associated with it.  It does
free *some* of it, but not all.  I don't see any possible objection to
freeing all the related memory in this case, since calling refresh would
invoke undefined behavior.

--
brian m. carlson / brian with sandals: Houston, Texas, US
+1 713 440 7475 | http://crustytoothpaste.ath.cx/~bmc | My opinion only
troff on top of XML: http://crustytoothpaste.ath.cx/~bmc/code/thwack
OpenPGP: RSA v4 4096b 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187

Attachment: signature.asc
Description: Digital signature

Reply via email to