6 years, 9 months ago.

Debug a vector running out of memory

For the first time in my code I am using the std::vector. I am writing a program for the nucleo F303 which has 512Kb flash and 80Kb SRAM.

The program usually runs well, but sometimes when adding elements to the vector it finishes with an error "Operator new out of memory".

Oh you run out of memory- you would say, but actually no, the vector so far has only 275 unsigned shorts which uses only 550 bytes.

Plus this very same program has handled vectors with many more elements (500 or so). I am wondering why the vector runs out of memory and if anyone has had the same problem


on the other hand I usually use the web compiler, I am willing to debug in this case, can anyone recommend me a tool for mbed programs for the nucleo. i am thinking Keil 5 but recommendations, or advice very welcome

Be the first to answer this question.