Can I have a solution to override all classes' operator new and delete? or we can only override for one class? ---------------------------------------- > From: iant@xxxxxxxxxx > To: zanshigang@xxxxxxxxxxx > CC: gcc-help@xxxxxxxxxxx > 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