Re: gtk+-1.2.10 has memory leak?

On Fri, 30 Jan 2004, qn wang wrote:

> Daniel, John Cupitt and havardk ... 
> Thank you all for your answer. Now I know it's no need to free a static 
> string. 
> But how about this one showed blow? It's from gdk.c. 
> The argv_orig will not be freed if this function exit with false.(see 
> //****//) 
> Will this lead to a memory leak? 

OK I was wrong the last time (I didn't spot the static
declaration), so whatever I say sould be taken with a grain of
salt here.

It looks, however, as if this function indeed could allocate
memory without freeing it, but I think it is only used in a
context where the application quits anyway because no display
could be opened. This is fine because in this case the memory is
automatically freed by the operating system.

It still is unclean programming in my book; I always try to free

The really problematic leaks are of course those that occur
within functions that are called many times in a running
application. I don't think there's a way around using a memory
debugging tool (which of course would find this particular,
harmless leak).


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