[MPlayer-G2-dev] Re: g2 config - restart...
Arpi
arpi at thot.banki.hu
Thu May 15 11:49:08 CEST 2003
Hi,
> Until now imho there is no big problem with implementing such stuff.
> The only problematic thing that i can see is the current main problem
> of the 'new' config code in G1 : dynamicly allocated stuff vs. mem
> leak vs. static values.
> If we strictly deal with struct that are create by (properly) copying
> the default stuct it's not a problem as we will only have dynamiclly
> allocted stuff.
> But if we also want to operate on 'normal' vars (we probably want)
> then it's a problem.
> In current G1 it's solved with a hack (when options are registered
> in the context saving system those who use dynamicly allocted
> mem (like string) have their initial value replaced by a copy of it
> so there is then only dynamic stuff). If somebody know how one can
> tell if a mem area was dynamiclly allocated or not then it's easy
> to solve. Othewise i really can't think of smthg clean.
Sure, i was also thinking of it yesterday.
The best would be to store somewhere (but where???) a flag telling the config
system that the given field (string) was allocated by the config sys.
It isn't really doable.
The opposite approach is what you said: always duplicate (alloc+copy)
everything, so you can safely free() at the end.
The 3rd approach is not free() at all, it isn't big memory leak :)
A'rpi / Astral & ESP-team
--
Developer of MPlayer G2, the Movie Framework for all - http://www.MPlayerHQ.hu
More information about the MPlayer-G2-dev
mailing list