[webkit-dev] freeing static variables

Adam Treat treat at kde.org
Thu Jul 30 07:26:28 PDT 2009


On Thursday 30 July 2009 02:55:18 am Zoltan Herczeg wrote:
> Hi,
>
> any thoughts on this? I hope my qestion was clear :) I would like to pack
> the static declarations into wrapper classes, so we can add platform
> and/or compilation mode (debug/release) dependent functionality to all
> static variables (i.e: freeing them on exit).
>
> Zoltan

I've tried this before and it didn't work out so well.  The order in which you 
free them becomes very important and error prone.  

And, of course, whatever solution you make has to be optional and easy to 
maintain as the default policy in WebKit is to not care - by design - about 
cleaning up after static globals on exit as that is left to the OS.

Another strategy for the embedded case where you want to free everything on 
exit is to create a custom memory handler that will do this for you.

Cheers,
Adam


More information about the webkit-dev mailing list