Re: gtk+-1.2.10 has memory leak?



Hi Qn,

rev_path is declared static, so there is no leak, except for the length of the final string returned by gtk_widget_class_path(). This will not grow over time, so is unimportant.

In fact, your suggested change will crash: you need to NULL rev_path as well. But the change will make the function slower, and will not save any memory.

I've used memprof and valgrind on largish (250,000 lines of C) gtk+-1.2 programs and not seen any memory leaks, except for a few tiny static strings, like the one you've found here.

John

qn wang wrote:
> I still want to ask something more about memory leak. Here I get some 
> source of a function from the gtkwidget.c. Based on these source I 
> wonder that maybe memory leak will happen,
> because rev_path is not freed after using g_realloc() to allocate memory 
> for it.
> 
> And my suggestion to fix it is to add "g_free(rev_path);" at
> the last line.



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