[webkit-dev] global new/delete operator in WebKit

İsmail Dönmez ismail at namtrac.org
Thu Feb 18 07:36:13 PST 2010


Hi Stephan;

On Thu, Feb 18, 2010 at 5:30 PM, Stephan Assmus <superstippi at gmx.de> wrote:

> Hi,
>
> On 2010-02-18 at 15:59:35 [+0100], İsmail Dönmez <ismail at namtrac.org>
> wrote:
> > Picking up and old thread I know...
> >
> > On Wed, Jan 13, 2010 at 7:19 PM, Darin Adler <darin at apple.com> wrote:
> >
> > > Yong Li also asked about standard library functions calling new and
> > > delete,
> > > specifically STL. I believe we have been avoiding calling these
> functions
> > > in
> > > WebKit, but I may be mistaken.
> > >
> >
> > Recently I came across some memory corruption issues and turns out that
> > WebKit uses std::stable_sort which uses the operator new(nothrow) . I am
> not
> > sure if there is a useful replacement but its good to know about this.
>
> Can you elaborate on this? Were these the cause for your memory corruption?
> If yes, where and how did you solve it?
>
>
For my own WinCE port I override new & delete globally via a special memory
pool. I override all 8 signatures of new & delete so its supposed to work
fine. But...

std::stable_sort calls operator new(nothrow) which somehow does not pick up
my replacement but it does use my delete replacement. So I end up deleting
memory I didn't allocate which as expected crashes.

I am still debugging why STL would not use my replacement function, but
meanwhile beware about this :-)

Regards,
İsmail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20100218/667484e3/attachment.html>


More information about the webkit-dev mailing list