Page 1 of 1

Using C++ std::stringstream and heap exceptions

Posted: Sun May 21, 2017 4:40 am
by kolban
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.

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

Posted: Sun May 21, 2017 5:18 am
by ESP_Sprite
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.

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

Posted: Sun May 21, 2017 10:44 am
by ESP_igrr
Stringstreams from STL should work. If you have a case to reproduce this issue, please post it on GitHub.