New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TW#15756] New toolchain (1.22.0-73-ge28a011) reduces free heap by 20Kb #1072
Comments
I have added some debug outputs in do_global_ctors()
The output:
I have no access to __init_array_end symbol. |
Hi @mkonnov, Thanks for reporting this. After investigating, I've determined this was caused by enabling libstdc++ exception support in the new toolchain. There's a global constructor in Unfortunately because the rest of libstdc++ is compiled with exception support, and some parts of ESP-IDF use libstdc++, I don't believe we can fix this without releasing a new toolchain. Most of our team is on holidays this week (Golden Week in China) so it may be a little while before a fix is released. In the meantime, if you are not using the new libstdc++ features and you are also not using PSRAM, the easiest workaround is to roll back to the old toolchain until this is fixed. The build system will print a warning, but you shouldn't experience any problems unless you're relying on the aforementioned two items. |
@projectgus thanks for your reply. I think that this should be reasonable to remove this scary warning
until Espressif guys roll out (AFTER TESTING !!!111) the new toolchain. |
I just upgraded to the new version, and before, a simple code had 300kB free. Now it's showing 280kB. This "unwanted problem" really did appear. I'll be following the updates on that. |
Turns out I was wrong, it's possible to fix this without updating the toolchain. I have a fix I'm testing here, if all goes well it should be merged next week after my colleagues have a chance to review.
I understand you're frustrated about the regression of RAM usage, that's understandable. I want to clarify, before the master branch is pushed to github it is run through a bank of unit tests and a bank of integration tests (including WiFi & Bluetooth connectivity tests) with various configurations. We don't have an automated test for memory use regressions, although due to this regression I'm going to look at ways to add this test. Despite this automated testing, our master branch is not a stable release. Stable releases also receive substantial manual Q&A testing which is not feasible for us to run on every commit. Developers also test changes manually, but we're only human so mistakes sometimes happen. Stable releases can be found here: https://github.com/espressif/esp-idf/releases (The current master branch is a pre-V3.0.) |
@projectgus I appreciate your reply. |
@igrr is it fixed ? |
the fix does not work. even with |
Hi @rojer, I'm not able to see this building examples on the master branch, if I instrument do_global_ctors() then I see 16 bytes of free heap delta before/after constructors run. In my tests __cxa_allocate_exception is linked, but it's the stub version in component/cxx/cxx_exception_stubs.cpp which doesn't pull in eh_alloc.cc. It's possible there's a linker order where this doesn't happen as expected and you get the version from libstdc++ instead. Do you have an .elf file and .map file you can share? |
i instrumented
and yes, it comes from libstdc++'s eh_alloc:
looking... |
So, for some reason when the linker has gone looking for __cxa_alloc_exception then it's pulled in the libstdc++ version instead of the stub, and the libstdc++ version also has that global constructor which allocates the emergency pool. Some combination of the map file and the ld command line should help us work out what the difference is, here. |
|
to close the loop: i was missing the |
Updated from xtensa-esp32-elf-linux64-1.22.0-61-gab8375a to xtensa-esp32-elf-linux64-1.22.0-73-ge28a011.
Added some logs into xTaskCreatePinnedToCore to trace this failure:
Estimating the following during startup:
gab8375a revision (works fine):
ge28a011 revision (fails)
In an old revision, there's 24396 left against 5176 in a new one after "esp_timer" task creating.
Where's my 20kb ? I need my money back.
The text was updated successfully, but these errors were encountered: