One question about operator new in libstdc++.
Shigang Zan
zanshigang@hotmail.com
Sat Oct 16 05:34:00 GMT 2010
Can I have a solution to override all classes' operator new and delete? or we can only override for one class?
----------------------------------------
> From: iant@google.com
> To: zanshigang@hotmail.com
> CC: gcc-help@gcc.gnu.org
> Subject: Re: One question about operator new in libstdc++.
> Date: Fri, 15 Oct 2010 12:24:09 -0700
>
> Shigang Zan writes:
>
> > My question is does operator new will always call malloc?
> > When I try to write a tool to monitor malloc/free for memory leak, is it enough? If malloc/free have no problem, can we make sure C++ code also have no problem in memory leak issue?
>
> Programs are permitted to define their own version of operator new.
> However, if you don't do that, then, yes, when using g++, all calls to
> operator new will call malloc.
>
> Ian
More information about the Gcc-help
mailing list