[prog] ncurses memory leak?
millward at Ms.UManitoba.CA
Sun May 30 12:39:40 EST 2004
I've been using valgrind to track down possible
memory leaks in one of my programs. It's been
suggested by some on this site that the reported
leaks ( "still reachable 35,912 bytes in 158 blocks")
are caused by global pointers, but I think not.
My program is a simple little linked-list and I've
freed and NULLed every pointer I can find.
After compiling my program, px4.c :
gcc -I/usr/include -Wall -W -g -o px4 px4.c -lncurses -lform
and it compiles clean,
I run it using valgind to find memory leaks:
valgrind --verbose --leak-check=yes --show-reachable=yes px4
The messages scroll accross my screen real quick, and
I only see one screen of them on the command line, including the summary.
I should have checked sooner, but not until yesterday did I
run valgrind in Gnome terminal and saved all the diagnostics to a text file.
Almost all of them point to /usr/lib/libncurses.so.5.2
For example, this message from valgrind :
==2011== 2857 bytes in 3 blocks are still reachable in loss record
21 of 22
==2011== at 0x40026AB0: malloc (vg_replace_malloc.c:153)
==2011== by 0x40267E08: _nc_doalloc (in /usr/lib/libncurses.so.5.2)
==2011== by 0x4026A462: tparm (in /usr/lib/libncurses.so.5.2)
==2011== by 0x40255B66: _nc_mvcur_init (in /usr/lib/libncurses.so.5.2)
I could be very wrong, but could the memory leaks be in the
ncurses library? If so, do you think this is serious enough to
More information about the Programming