You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a fairly large system that dynamically allocates a lot of things up front using smart pointers.
When setting things up 2 large vectors are reserved up front. If vec reserves 3000 and vec1 reserves 2500, I get the output above. If I raise vec1 to reserve 2750 I get a constant boot loop. With |<-CORRUPTED beside the backtrace. From the output above it looks like I have plenty of space to be able to reserve those vectors upfront.
All of this memory will get allocated before setup. Is that an issue?
0x40083a61: panic_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/panic.c line 402
0x4008daad: esp_system_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/esp_system.c line 128
0x40093025: abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/newlib/abort.c line 46
0x4016ccb7: __cxa_call_terminate(_Unwind_Exception*) at /builds/idf/crosstool-NG/.build/HOST-x86_64-apple-darwin12/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/eh_call.cc line 58
0x4016ccfe: std::get_terminate() at /builds/idf/crosstool-NG/.build/HOST-x86_64-apple-darwin12/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc line 97
0x4015e69b: __cxxabiv1::__cxa_throw(void*, std::type_info*, void (*)(void*)) at /builds/idf/crosstool-NG/.build/HOST-x86_64-apple-darwin12/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/eh_throw.cc line 90
0x4015e1ae: operator new(unsigned int) at /builds/idf/crosstool-NG/.build/HOST-x86_64-apple-darwin12/xtensa-esp32-elf/build/build-cc-gcc-final/xtensa-esp32-elf/no-rtti/libstdc++-v3/include/bits/exception.h line 63
0x400d5a79: __gnu_cxx::new_allocator >::allocate(unsigned int, void const*) at /Users/avance/Library/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/xtensa-esp32-elf/include/c++/8.4.0/ext/new_allocator.h line 99
0x400d5c17: std::vector , std::allocator > >::reserve(unsigned int) at /Users/avance/Library/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/xtensa-esp32-elf/include/c++/8.4.0/bits/stl_vector.h line 1395
0x400d5db5: component::timing::context_impl::context_impl(std::shared_ptr const&, std::shared_ptr const&, std::shared_ptr const&, std::shared_ptr const&, std::shared_ptr const&, std::shared_ptr const&, std::shared_ptr const&) at /Users/avance/Library/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/xtensa-esp32-elf/include/c++/8.4.0/bits/shared_ptr_base.h line 1018
0x400d678d: component::timing::timing::create(std::shared_ptr const&, std::shared_ptr const&, std::shared_ptr const&, std::shared_ptr const&, std::shared_ptr const&, std::shared_ptr const&) at /Users/avance/Library/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/xtensa-esp32-elf/include/c++/8.4.0/bits/shared_ptr_base.h line 1182
0x400d3c1a: _GLOBAL__sub_I_status_led() at /Users/avance/Library/Arduino15/packages/esp32/tools/xtensa-esp32-elf-gcc/gcc8_4_0-esp-2021r2-patch3/xtensa-esp32-elf/include/c++/8.4.0/bits/shared_ptr_base.h line 1167
0x400f719f: start_cpu0_default at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp_system/startup.c line 422
0x40083162: call_start_cpu0 at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/hal/esp32/include/hal/cpu_ll.h line 39
Other Steps to Reproduce
I found this: #1163
It suggests to dynamically allocate the memory which is what I am doing.
I moved all the allocation to setup and it has fixed the issue!
I had a separate branch where I was moving all startup initialisation to a separate class and out of the global section, I just hadn't got round to the new change of reserving the vectors! Darn!
Board
ESP32 Dev Module
Device Description
DevKitC
Hardware Configuration
NA
Version
v2.0.4
IDE Name
Arduino IDE
Operating System
macOS
Flash frequency
80Mhz
PSRAM enabled
no
Upload speed
921600
Description
ESP.getFreeHeap(); ESP.getMaxAllocHeap(); heap_caps_get_largest_free_block(MALLOC_CAP_8BIT)
Output:
I have a fairly large system that dynamically allocates a lot of things up front using smart pointers.
When setting things up 2 large vectors are reserved up front. If
vec
reserves 3000 andvec1
reserves 2500, I get the output above. If I raisevec1
to reserve 2750 I get a constant boot loop. With|<-CORRUPTED
beside the backtrace. From the output above it looks like I have plenty of space to be able to reserve those vectors upfront.All of this memory will get allocated before
setup
. Is that an issue?Sketch
Debug Message
Other Steps to Reproduce
I found this: #1163
It suggests to dynamically allocate the memory which is what I am doing.
I also found this: https://www.esp32.com/viewtopic.php?f=19&t=8130
The last comment explains my confusion and probably the problem I'm hitting.
I have checked existing issues, online documentation and the Troubleshooting Guide
The text was updated successfully, but these errors were encountered: