FYI

---------- Forwarded message ----------
From: praveen munukutla <[email protected]>
Date: Mon, Dec 12, 2011 at 11:12 AM
Subject: [webkit-dev] How to OverLoad the new operator in webkit ?
To: [email protected]


Hello Mr.Zoltan,

Thanks for the response.We are using the webkit revision of 72805.So we are
bound to use the Class version of FastAllocBase/Noncopyable .

I have to implement the "placement new" for memory leaks.I have written the
void* new(size_t,const char*,int) definition in the FastAllocBase.h ->
NonCopyable -> page.For testing purpose im trying to call the placement new
defined in the FastAllocBase from page. as


int * p = new(__FILE__,__LINE__) int;

which eventually should pick the void* new(size_t,const char*,int) but it
not happening .I am getting linker errors as void* new(size_t,const
char*,int) is undefined.

any idea how to solve this ?

Thanks ,
Praveen

Message: 19
Date: Fri, 9 Dec 2011 16:48:15 +0530
From: praveen munukutla <[email protected]>
To: [email protected]
Subject: [webkit-dev] How to OverLoad the new operator in webkit ?
Message-ID:
       <cadhz4c7hshvnmkpnwj2n8vfkywkd2rgdeq2qhywlqtr8fxv...@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <
http://lists.webkit.org/pipermail/webkit-dev/attachments/20111209/81f96b98/attachment-0001.html
>

------------------------------

Message: 20
Date: Fri, 09 Dec 2011 12:33:24 +0200
From: "Zoltan Horvath" <[email protected]>
To: [email protected]
Subject: Re: [webkit-dev] How to OverLoad the new operator in webkit ?
Message-ID: <[email protected]>
Content-Type: text/plain; charset=iso-8859-1; format=flowed; delsp=yes

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



-- 
~Praveen Munukutla
_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to