Using C++ std::stringstream and heap exceptions

User avatar
Posts: 1447
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Using C++ std::stringstream and heap exceptions

Postby kolban » Sun May 21, 2017 4:40 am

I am working in some C++ code and needed to format some string and numeric data so started using std::stringstream. Functionally, all appeared to work until I end a task that was using these classes. At this point I get an exception:

0x40083a0b: prvInsertBlockIntoFreeList at /home/kolban/esp32/esptest/esp-idf/components/freertos/./heap_regions.c:410

This makes me feel that some storage has been lost or corrupted. I checked and checked and checked my code but am missing the issue.

A fundamental question ... are the use of standard template library routines such as std::stringstream considered supported? If I run into reproducible problems using STL, will GitHub issues be examined? I don't want to waste anyones time if we believe that the the STL used in conjunction with ESP-IDF simply isn't a supported combination.
Free book on ESP32 available here:

Posts: 1567
Joined: Thu Nov 26, 2015 4:08 am

Re: Using C++ std::stringstream and heap exceptions

Postby ESP_Sprite » Sun May 21, 2017 5:18 am

That is indeed the sign of a corrupted memory blocklist. One thing that comes to mind: do you exit your task with vTaskDelete? Not doing so (and just returning from the task function) leads to a crash, though I'm not sure anymore if it was this crash or something else.

Posts: 974
Joined: Tue Dec 01, 2015 8:37 am

Re: Using C++ std::stringstream and heap exceptions

Postby ESP_igrr » Sun May 21, 2017 10:44 am

Stringstreams from STL should work. If you have a case to reproduce this issue, please post it on GitHub.

Who is online

Users browsing this forum: keramazigh and 3 guests