[gccsdk] C++ and malloc

John Tytgat John.Tytgat at aaug.net
Sun May 18 20:34:15 BST 2008

In message <3fce88a14f.Jan-Jaap at iyonix.c2i.net>
          Jan-Jaap van der Geer <janjaap at dsv.nl> wrote:

> Hello,
> I am trying to find an irritating heisenbug in my code. Sometimes
> my C++ program exits with malloc errors. The strange thing is that
> I do not use malloc in my code, except for one place, where I do
> use it. However, when it fails it should not be anywhere near that
> code.
> So I wonder if C++ / GCC internally use malloc to implement "new"
> and stuff like that. Does anyone know?

Yes, that's certainly the case. E.g. for the GCCSDK 3.4.6 code base:
& other flavors of 'operator new'.

> If so, any chance on using fortify to help me finding this bug?

Never tried it myself for C++ programs but it looks like it supports C++
so worth a try.  Or use dmalloc (see Autobuilder).

Good luck,
John Tytgat, in his comfy chair at home                                 BASS
John.Tytgat at aaug.net                             ARM powered, RISC OS driven

More information about the gcc mailing list