Unused C++ Standard Library Functions Being Linked In Project

Sysprogs forums Forums VisualGDB Unused C++ Standard Library Functions Being Linked In Project

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #11297
    Seidleroni
    Participant

    I am looking to migrate from IAR to VisualGDB for development purposes. When I compile my application in IAR, it is ~50KB in size. With VisualGDB it is 216KB, even with optimizations (-O3) turned on. Looking through the Embedded Memory Explorer, I see “locale_facets_nonio.tcc” and “locale_facets.tcc” taking up a ton of space. It looks like these are providing the C++ std library functions, but I’m not using any of them. Is there a reason that VisualGDB is linking these in to create such a huge output file?

    Also, I am using the Newlib-nano C library in my project. I can email a copy of my project to the support e-mail if necessary.

     

    #11299
    Seidleroni
    Participant

    I figured out that the issue was I was including <iostream>. Removing this reference brought down my code size by ~160KB. I needed iostream to use cout, which I then replaced with printf. I am surprised that there is no newlib replacement.

    #11304
    support
    Keymaster

    Hi,

    The GCC’s STL implementation is indeed not very well optimized, so printf() is a good alternative.

    BTW, you can use the dependency view in the embedded memory explorer to quickly see what pulls the large functions in: https://visualgdb.com/tutorials/arm/dependencies/

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.