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: Wed, 17 Jun 2020 19:39:43 -0400
User-agent: NeoMutt/20170113 (1.7.2)

On Wed, Jun 17, 2020 at 10:07:24AM +0200, Benno Schulenberg wrote:
> 
> Op 17-06-2020 om 01:43 schreef Thomas Dickey:
> > 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).
> 
> Nano was not seeing exit_curses() either.  Grepping config.log for
> "include/ncurses" showed -I/usr/local/include/ncursesw most of the time,
> but then near the end it started adding -I/usr/include/ncursesw before it,
> and then puts this in the Makefiles:
> 
> CPPFLAGS='-D_GNU_SOURCE -D_DEFAULT_SOURCE -I/usr/include/ncursesw
> -I/usr/local/include/ncursesw'
> NCURSESW_CFLAGS='-D_GNU_SOURCE -D_DEFAULT_SOURCE -I/usr/include/ncursesw'
> 
> Nano's configure is doing something wrong.  If I edit the Makefiles to

In our earlier conversation here:

https://lists.gnu.org/archive/html/bug-ncurses/2020-04/msg00015.html

I mentioned that I had overridden the configure script, to get tracing.
(Exporting NCURSESW_CFLAGS and NCURSESW_LIBS fixed it for me).

> >> ../test/picsmap.c:965:11: warning: implicit declaration of function 
> >> ‘strcasecmp’
> >> [-Wimplicit-function-declaration]
> >>       if (!strcasecmp(name, rgb_table[n].name)) {
> >>            ^~~~~~~~~~
> 
> The warning isn't there any more on subsequent compiles.  :|

That sounds like some problem with one of the predefined symbols, e.g.,
_DEFAULT_SOURCE, etc.
 
> >> 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?
> 
> The ones that were near the beginning of the email:
> 
>   ./configure -C --enable-widec --with-shared --prefix=/usr/local 
> --disable-leaks

When I do that, I see in /usr/local/include/ncursesw/curses.h:

-----------------------------------------------------------------------------
#if 1
#undef  NCURSES_SP_FUNCS
#define NCURSES_SP_FUNCS 20200613
#define NCURSES_SP_NAME(name) name##_sp
-----------------------------------------------------------------------------

and in the corresponding unctrl.h

-----------------------------------------------------------------------------
#include <ncursesw/curses.h>

#undef unctrl
NCURSES_EXPORT(NCURSES_CONST char *) unctrl (chtype);

#if 1
NCURSES_EXPORT(NCURSES_CONST char *) NCURSES_SP_NAME(unctrl) (SCREEN*, chtype);
#endif
-----------------------------------------------------------------------------

That is, including the configured/installed curses.h changes the latter
"unctrl" to "unctrl_sp".  But if you're picking up some other copy of
curses.h, that macro could be defined in the other chunk from curses.h:

-----------------------------------------------------------------------------
#undef  NCURSES_SP_FUNCS
#define NCURSES_SP_FUNCS 0
#define NCURSES_SP_NAME(name) name
#define NCURSES_SP_OUTC NCURSES_OUTC
-----------------------------------------------------------------------------

When I'm unsure where an include-file came from, I set up my makefile to
capture the output from the C preprocessor, which (for gcc at least) gives
the pathname of the included files.

-- 
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]