Re: gtk2-perl / a script to help converting basic functions



Le mer 23/10/2002 à 11:44, Guillaume Cottenceau a écrit :
Daniel Lacroix <dlacroix erasme org> writes:

Which is correct, and pretty helpful :).

I don't share to point of view. The gtkperl_text_buffer_get_text
function is not correct. It will create a memory leak in Gtk2-Perl. The
gtk_text_buffer_get_text function like many other is returning an
allocated string which must be freed with g_free when we no more need
it. This is often the case for function which return char *.

I think that we must copy the string in a perl string and g_free the
return value before exiting the function. I have not the solution
("code") for now but you must be aware of that I try to correct this.

I see - while this is not strictly a problem from the script,
the rest of the code probably containing more occurence of the
like.

Do we have an helpful tool to efficiently/easily check for memory
leaks?

Don't know any but test script with loop on the function will show the
problem if you are looking at the memory allocation. But, this is not a
solution for automatic test.

-- 
Guillaume Cottenceau - http://people.mandrakesoft.com/~gc/

Daniel Lacroix




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