View Single Post
Old 10-27-2008, 07:36 AM   #5
Antartica
Evangelist
Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.Antartica ought to be getting tired of karma fortunes by now.
 
Antartica's Avatar
 
Posts: 423
Karma: 1517132
Join Date: Jun 2006
Location: Madrid, Spain
Device: quaderno, remarkable2, yotaphone2, prs950, iliad, onhandpc, newton
Quote:
Originally Posted by ericshliao View Post
Now, I have another guess: the problem might come from the GtkWidget and GdkPixbuf that I used to load and store image. It might because the old one is not cleared when I create a new one, even though I always re-use the same pointers to point to GtkWidget and GdkPixbuf.
Oh! I love Java. When I set a pointer or object to null, JVM will collect garbage automatically for me.
To debug this type of errors, valgrind (http://valgrind.org/ ; "apt-get install valgrind") is of great help.

valgrind --leak-check=full --show-reachable=yes ./myprog 2>/tmp/valgrind.log

You will get at program exit the locations of the mallocs of the memory that was leaked. You have to compile your program with debugging information (i.e. "gcc -g myprog.c -o myprog")

The only catch is that you have to use a build of your program for x86 (not for arm/scratchbox), but I suppose that you already have the makefiles prepared for that to ease debugging :-)
Antartica is offline   Reply With Quote