bug-ncurses
[Top][All Lists]
Advanced

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

Re: ncurses seems to be leaking memory?


From: Thomas Dickey
Subject: Re: ncurses seems to be leaking memory?
Date: Tue, 16 Jun 2020 19:43:48 -0400
User-agent: NeoMutt/20170113 (1.7.2)

On Tue, Jun 16, 2020 at 05:01:48PM +0200, Benno Schulenberg wrote:
> 
> (Sorry, I did not see your replies.  I should have said:
> please CC, not subscribed.)
> 
> Op 11-06-2020 om 13:32 schreef Benno Schulenberg:
> > With that version there were no more invalid reads, but now
> > valgrind reported possibly lost blocks.
> 
> I've reconfigured ncurses with --disable-leaks and recompiled,
> and added a call to _nc_free_and_exit() at the end of nano,
> but the compiler says it does not known the function: implicit
> declaration.  Do I need to use still other configure flags?
> I've used this:
> 
>   ./configure -C --enable-widec --with-shared --prefix=/usr/local 
> --disable-leaks

no - I purposefully didn't provide prototypes for those functions since
my original intent was to use them only in developing the library.

However, in one of the changes before 6.2, I did this, to make it
easier to configure applications that might use the feature:

https://invisible-island.net/ncurses/NEWS.html#t20191214

20191214
        + add exit_curses() and exit_terminfo() to replace internal symbols for
          leak-checking.
 
Those functions are provided whether or not --disable-leaks is configured
(but will only _help_ with leak-checking if --disable-leaks is configured).

https://invisible-island.net/ncurses/man/curs_memleaks.3x.html

Thinking about the pros/cons, I decided that I was better off by
providing a stub for a public entrypoint than having an entrypoint
that existed only for a debugging library.

> By the way, while compiling ncurses, I saw this warning pass:
> 
> ../test/picsmap.c: In function ‘lookup_rgb’:
> ../test/picsmap.c:965:11: warning: implicit declaration of function 
> ‘strcasecmp’
> [-Wimplicit-function-declaration]
>       if (!strcasecmp(name, rgb_table[n].name)) {
>            ^~~~~~~~~~

offhand, I see that warning only when compiling with MinGW or MSYS2.

At the moment I don't recall if that was a missing prototype, or
some incorrect ifdef (either way, a problem with their header files
since the function does exist).

Some other system or configuration may be a problem -- but
according to a manpage on this machine, it didn't seem to be
likely:

        CONFORMING TO
               4.4BSD, POSIX.1-2001, POSIX.1-2008.
 
> Also, after installation of ncurses into /usr/local, there
> seems to be something wrong with one of the header files:
> 
> In file included from ./nano.h:89:
> In file included from /usr/include/ncursesw/curses.h:2076:
> /usr/local/include/ncursesw/unctrl.h:61:54: error: conflicting types for 
> 'unctrl'
> NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(unctrl) (SCREEN*, 
> chtype);
>                                                      ^
> /usr/local/include/ncursesw/unctrl.h:58:38: note: previous declaration is here
> NCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype);
> 
> I work around that by editing that header file and changing the "#if 1"
> on line 60 to "#if 0".

What configure-options are you using?

-- 
Thomas E. Dickey <dickey@invisible-island.net>
https://invisible-island.net
ftp://ftp.invisible-island.net

Attachment: signature.asc
Description: PGP signature


reply via email to

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