[MPlayer-dev-eng] Where to free loose memory?
The Wanderer
inverseparadox at comcast.net
Thu Sep 16 21:32:22 CEST 2004
D Richard Felker III wrote:
> On Thu, Sep 16, 2004 at 02:04:25PM -0400, The Wanderer wrote:
>> Is there any one canonical place, or group of places, where memory
>> is supposed to be freed - one of the exit_* functions, perhaps - or
>> should I just make my best guess as to a place which is after the
>> final use of the variable in question?
>
> freeing memory in exit_* functions is useless.
Having paid a bit more attention to what gets not-freed where than I had
done before, this is now obvious; it's not only useless, so far as I can
tell it'd most likely be impossible in many cases.
> if it's just a block of memory allocated for the whole duration of
> the program, it never needs to be freed. free is useful for things
> that can get allocated again and again (and thus cause memory usage
> to keep growing if they're not freed).
True enough (assuming I understand you), but the perfectionist in me
dislikes leaving memory allocated but not freed - which is the other
part of why I'm doing this in the first place. Most of the unfreed
things I've seen so far appear to be config-related, and so presumably
not allocated more than once (unless reconfiguring is necessary), but
the principle remains.
I take it, then, that your answer is either "wherever it seems to work"
or "there's no benefit to doing it at all"?
--
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