Re: Memory Leaks



Andrew Krause wrote:

I think this is more of a general C/C++ question, but I'll try
here. My problem is that as my application runs longer, the memory
usage slowly creeps up higher and higher. For example, if I call
my Environment Settings dialog five times in a row, each time it
uses more memory.

Now this makes sense except that I am hiding the dialog and then
using g_free() to free the memory that was allocated by the dialog
after each hide. It sort of becomes a problem after a while
because too much memory is being used, although this threshold
usually doesn't appear for a few hours.

I know I am probably just being ignorant, but I've never programmed
any application that was large enough that I had to worry about
memory allocation at all. Thanks for any help you can give me!

---
Andrew Krause _______________________________________________
gtk-list mailing list
gtk-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-list
You might want to have a look at valgrind.

At least with version 2.2 the following syntax should tell you something about memory leaks in your application:

valgrind --tool=memcheck --num-callers=20 --leak-check=yes  ./yourappname

http://www.valgrind.org

-Todd




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