The GCC toolchain combined with the latest open source C++ standard library
libstdc++-v3) might be found to generate large code and data
fragments as compared to an equivalent C program. A significant portion of this overhead
comes from code and data for exception handling and runtime type information. Some C++
applications do not require these features.
To remove the overhead and optimize for size, use the
-fno-exceptions and/or the
switches. This is recommended only for advanced users who know the requirements of their
application and understand these language features. Refer to the GCC
documentation for more specific information on available compiler options and
C++ programs might have more intensive dynamic memory requirements (stack and heap size) due to more complex language features and library routines. Many of the C++ library routines can request memory to be allocated from the heap. Review your heap and stack size requirements for C++ programs to ensure that they are satisfied.