Re: Memory leaks



On Wed, Feb 9, 2011 at 12:54, John Emmas <johne53 tiscali co uk> wrote:

On 9 Feb 2011, at 08:44, Tor Lillqvist wrote:

A *true* leak, in my opinion, is if performing some code sequence over
and over again (like what happens if you just do the same UI actions
repeatedly) causes the amount of unreachable memory to grow
continuously.

It's an interesting argument and I could (almost) agree with it if we were referring specifically to 
program initialisation - but let me cite my earlier example of g_warning().  A call to g_warning() results 
in 16 memory leaks but when I re-tested it after reading your comment, I realised that 2 calls still only 
produce 16 leaks.  So by your definition Tor, g_warning() doesn't count as code that leaks memory.  I would 
say that it does leak memory because the leak can happen anywhere in my program and won't happen at all a 
g_warning() never gets issued.  When it does leak though, it won't necessarily be associated with the 
program being initialised so in my view, g_warning() is definitely an example of leaking code.


No, it just delayed initialization of the logging subsystem.

-- 
Andrew W. Nosenko <andrew w nosenko gmail com>



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