nvteighen
July 29th, 2008, 03:49 PM
I'm currently learning to use the ncurses library and have noticed that valgrind reports memory leakage when using it. Searching in Google shows me some people complaining on having the same problem... The GNU ncurses page (http://www.gnu.org/software/ncurses/) says something like "reduced memory leaks" in the ncurses 5.6 release notes. What does "reduced" mean?... It's a bit annoying to me that a such a popular library may fail in proper memory management...
...but, I already had some stupid valgrind reports when using the CUPS library, which was related to shared memory. GTK+ applications do also usually report memory leakages, even for the "Hello World" from the GTK+ tutorial (http://library.gnome.org/devel/gtk-tutorial/stable/c39.html#SEC-HELLOWORLD).
So, whose fault is this? valgrind's? ncurses'? mine? cosmic rays'?
Here it's a little "Hello World" written in C using ncurses. It will leak aprox. 30 KB, still reachable memory:
/* Compile with -lncurses. Be sure you have the libncurses5-dev package
* installed. */
#include <curses.h>
int main(void)
{
initscr();
cbreak();
noecho();
printw("Hello!");
refresh();
getch();
endwin();
return 0;
}
The question is: If you use these libraries from a garbage collecting language like Python, there will also be leakages as they're occurring in a binary outside the collector's reach.
Thanks!
...but, I already had some stupid valgrind reports when using the CUPS library, which was related to shared memory. GTK+ applications do also usually report memory leakages, even for the "Hello World" from the GTK+ tutorial (http://library.gnome.org/devel/gtk-tutorial/stable/c39.html#SEC-HELLOWORLD).
So, whose fault is this? valgrind's? ncurses'? mine? cosmic rays'?
Here it's a little "Hello World" written in C using ncurses. It will leak aprox. 30 KB, still reachable memory:
/* Compile with -lncurses. Be sure you have the libncurses5-dev package
* installed. */
#include <curses.h>
int main(void)
{
initscr();
cbreak();
noecho();
printw("Hello!");
refresh();
getch();
endwin();
return 0;
}
The question is: If you use these libraries from a garbage collecting language like Python, there will also be leakages as they're occurring in a binary outside the collector's reach.
Thanks!