Skip to main content
Jeroen deBuffel
Associate III
August 30, 2022
Question

Check free memory (STM32L0)

  • August 30, 2022
  • 6 replies
  • 2700 views

Hello,

During code execution I would like to monitor the available memory. Is there a default function available to check the available RAM memory?

Thanks

This topic has been closed for replies.

6 replies

waclawek.jan
Super User
August 30, 2022

What do you mean by "available memory"?

Normally, memory is allocated during translation (linking) and you can check its consumption e.g. in mapfile.

Runtime, memory is consumed by stack and dynamic allocation (malloc() - heap). The latter is unlikely to be used in STM32L0. Stack pointer can be read out and checked runtime, but that has questionable value, given the check is not guaranteed to happen at the moment when the stack is at its deepest point.

So I'm not quite sure what exactly do you want to check and why.

JW

MM..1
Super User
August 30, 2022

Simple this function exist only on high level OS.

Read somethink c - malloc behaviour on an embedded system - Stack Overflow

Jeroen deBuffel
Associate III
August 30, 2022

Thanks for your feedback and links.

The reason why I would like to check memory (RAM) is because I used a external library with a memory leak. I solved the leak but it triggered me to look for a way to measure memory usage.

Tesla DeLorean
Guru
August 30, 2022

These things typical use simple linked lists with a small chaining structure ahead of the pointer returned by the allocator.​

The free memory list typically available as a pointer.​

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
Jeroen deBuffel
Associate III
August 30, 2022

Any example or tip? I search on Google but could not find them. Thnx