[Webkit-unassigned] [Bug 27980] Give an ability to WebKit to free statically allocated pointers before quit

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Aug 11 12:03:51 PDT 2009


--- Comment #26 from Yong Li <yong.li at torchmobile.com>  2009-08-11 12:03:49 PDT ---
(In reply to comment #25)
> (In reply to comment #2)
> > (In reply to comment #1)
> > > Created an attachment (id=34058)
 --> (https://bugs.webkit.org/attachment.cgi?id=34058) [details] [details] [details]
> > > First draft patch
> > 
> > This patch is intended to be a draft. I would like to hear your opinion about
> > this solution:
> >   - two new files are added to wtf directory: StaticPtr.h and StaticPtr.cpp
> >   - enabling FREE_STATIC_PTRS allows to free the pointers in a reversed
> > creation order
> >   - Although c++ supports automatic destructors, I think it would not be wise
> > to free the pointers in random order.
> Why not just let ~StaticPtr() to free memory? Static objects should be
> destructed in the reverse order of construction, as when a static object is
> constructed, atexit will be pushed to onexit queue. Also, you can always
> destruct all static objects by calling _cexit() explicitly. The only benefit of
> using a chain I can see is that it destructs all object first, and then frees
> all the memory, so that when a destructor accesses to another destructed static
> object, it won't result segment fault...

correction: atexit pushes the destructor to the onexit stack

Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

More information about the webkit-unassigned mailing list