C++ pure virtual base class memory consumption

Sebastian Huber sebastian.huber@embedded-brains.de
Fri Aug 24 12:26:00 GMT 2012

On 08/21/2012 08:39 PM, fueb wrote:
> Sebastian Huber-4 wrote:
>> Are you sure this code is from Newlib and not GCC?
> I think the code is being inserted by GCC and in turn many things from
> newlib get linked in.
> ../arm-none-eabi/lib/thumb2\libstdc++.a(pure.o)
> ../arm-none-eabi/lib/thumb2\libstdc++.a(eh_terminate.o)
> ../arm-none-eabi/lib/thumb2\libstdc++.a(eh_call.o)
> ../arm-none-eabi/lib/thumb2\libstdc++.a(eh_exception.o)
> and may other things I cannot post here since the mapfile is quite large.

The libstdc++ is not from newlib.  It is provided by GCC.  You should produce 
two map files, with and without the pure virtual function.  Compare the two map 
files and look at the additional modules.  It is very likely the unwinder and 
the exception handling support code.

> Sebastian Huber-4 wrote:
>> I suppose this is due to the abort handler with pretty printing pulled in
>> by a
>> pure virtual function.  You should look at the map file of the linker.
>> See also
>> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43852
> Newlib's printf is already in the application, this doesn't blow up the code
> so much, like the
> pure virtual function does. I've read the bug details but I am not very
> familiar with newlib.

This has nothing to do with newlib.

> Does it mean I have to rebuild my newlib installation with the mentioned
> compiler flags?

It depends an what you want.

Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

More information about the Newlib mailing list