cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F107RCT6 RAM overflowed

Hamster
Associate II

STM32F107RCT6 has 64K Bytes SRAM in total , i use just 26K Bytes, and heap still available, but it overflows, i get confused. if i just change Heap_4 to Heap_5, my code can compile successfully, but it doesn't work. how to solve this problem?error3.jpg

 

error1.jpgerror2.jpg

 

3 REPLIES 3

If the Linker reports an overflow something is clearly consuming it, so dig deeper as to what.

If using Heap and failing, make sure you check return pointer from malloc() and provide some diagnostic or telemetry to understand flow and dynamics in use.

Large arrays and local/auto variable allocation can lead to failure.

Inspect critically and debug...

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

i have checked my code, the largest array is 512 Bytes that was being malloced in the TcpServer thread, and i had changed this array smaller, it still overflow 416 Bytes. So i think this is not the true reason. i set the Linker Settings for the Minimum Heap Size and Stack Size is all 0x400 or even the 0x800, it will overflow more Bytes. if i set the Heap and Stack Size in default size(0x200), compile ok, but unworkable.

error4.jpg

Andrew Neil
Evangelist III

@Hamster wrote:

 my code can compile successfully, but it doesn't work.


Compiling successfully merely shows that there are no errors of C syntax or semantics - it gives absolutely no indication that your code will actually do what you wanted!

 

@Hamster wrote:

i have checked my code, the largest array is 512 Bytes that was being malloced in the TcpServer thread


If you're allocating it with malloc, then make sure that it gets released when you're finished with it!

Otherwise you will have a so-called memory leak - which is a great way to overflow your RAM!

https://en.wikipedia.org/wiki/Memory_leak

https://community.st.com/t5/stm32cubeide-mcus/out-of-memory-error-lwip/m-p/690500/highlight/true#M28434