Synergy Realtime RAM Usage in e2studio

Hi, I want to see the realtime RAM usage while debugging to be sure code will not have problem of overflowing RAM. Let me explain myself or what i understand a little bit.

There is a Memory Usage view in e2studio and i can see how much RAM is consumed before running the code on mcu. For example right now it shows me that %95 (14KB of 15KB max) of the RAM is used. As far as i know this usage shows me that global and static variables which always resides in RAM; consumes 14KB of the RAM. 1KB of RAM is remaining while running the code.

Lets assume i have a function which will be called after the start and in that function an array will be initialized with size of 2KB. Which will overflow the total RAM since only 1KB RAM were left. And this is bad. 

After building the code i checked that if im using the all the RAM, and i saw that im not using all of the RAM, there is still 1KB of RAM is free. But in run time a function will consume more than the free RAM size and code will crash.

Because of this i need to check if there is a risky position on run time in terms of RAM usage. If there is a view which shows realtime RAM usage, i can find the problem on debugging. Is there any view?

Sorry if this question is too wrong, and please correct me that would be really helpful. If there is no view to see RAM usage on run time, what you do to prevent that kind of errors? By the way project is not ThreadX RTOS.

Any help would be really helpful. Thank you.

  • Hi emree,

    On Synergy the "free" memory you see in e2studio is effectively unallocated memory. Everything else is allocated statically, including the memory region for dynamic memory allocation (malloc). If you aren't adding any more memory-consuming features to your application you can extend heap size (if used) by changing property on the BSP tab.

    Using unallocated memory through addresses is considered a bad practice. At the very least using something like malloc will handle the error case (return NULL) if requested size is too big.

    Regards