One question about operator new in libstdc++.

Ian Lance Taylor iant@google.com
Fri Oct 15 19:24:00 GMT 2010


Shigang Zan <zanshigang@hotmail.com> 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