[MPlayer-dev-eng] Where to free loose memory?

The Wanderer inverseparadox at comcast.net
Thu Sep 16 22:13:41 CEST 2004


Reimar Döffinger wrote:

> Hi,
> 
>> I take it, then, that your answer is either "wherever it seems to
>> work" or "there's no benefit to doing it at all"?
> 
> My answer usually is that it should be free as soon as possible,

I agree, for most purposes, but my trouble is figuring out where that
is, since it is not always easy to tell when something is no longer
going to be used. That's why I said "wherever it seems to work", i.e.,
finding a place by trial and error.

> but that would make some things unneccessarly complex. And whether
> the memory is free 10ms before exiting or never (explicitly) doesn't
> matter.

In practical terms, it doesn't, but I prefer to free them anyway -
variously for the sake of symmetry, for the sake of completism, and for
the sake of a few other things too silly to mention. Plus, as Joey
noted, there's no guarantee that all platforms will have proper on-exit
memory cleanup - so as long as there's no harm in doing so it's probably
best to take care of that yourself.

> And last but not least, a few 100k of unfreed memory don't matter
> much, but e.g. even 10 byte per minute do matter (e.g. loops that do
> malloc but foget to free).

Yes, indeedy-do. I haven't run across any of those yet (not obvious
ones, at least), but if I do find any I'll be sure to point it out...

-- 
       The Wanderer

Warning: Simply because I argue an issue does not mean I agree with any
side of it.

A government exists to serve its citizens, not to control them.




More information about the MPlayer-dev-eng mailing list