[webkit-dev] How to OverLoad the new operator in webkit ?

Zoltan Horvath zoltan at webkit.org
Fri Dec 9 02:33:24 PST 2011


Hi,

Noncopyable/FastAllocBase class doesn't exist anymore in WebKit, we turned  
them into macro implementations:

http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/wtf/FastAllocBase.h
http://trac.webkit.org/browser/trunk/Source/JavaScriptCore/wtf/Noncopyable.h

For primitive/POD types, you have to use FastNew to allocate and  
FastDelete to deallocate memory, please check it in FastAllocBase.h.

Btw,  new(1)int; ? Do you mean new int[1]?

Regards,

Zoltan Horvath



On Fri, 09 Dec 2011 13:18:15 +0200, praveen munukutla  
<munukutlapraveen at gmail.com> wrote:

> Hi all,
>
> How to OverLoad the new operator in webkit ?
>
> i have written an overloaded new operator void* operator new(size_t,int)  
> in
> the FastAllocBase.h
>
> Fastallocbase is being inherited by Noncopyable  and the Noncopyable is
> being inherited by class Page : public Noncopyable .
>
> now im calling  int* p = new(1)int; in Page constructor. Page.cpp and
> FastAllocBase.h are complied but there is a problem in linking.I am  
> getting
> a "undefined reference to operator new(unsigned int,int)" while linking
> time.
>
> Can anyone throw some light on this ?
>
>
> Thanks in advance.
> ~Praveen Munukutla.
-- 
Using Opera's revolutionary email client: http://www.opera.com/mail/


More information about the webkit-dev mailing list