2019-08-05 12:39 AM
Hi,
I am working on stm32f779 eval kit.
How can I detect memory leaks on stm32?
Can anyone please suggest ways.
2019-08-05 11:15 PM
You miss off some important information about your system.
What development software are you running? Some might have tools to help e.g. gcc has something called leaksanitizer.
Are you using c or c++? Is the leak with malloc/free or new/delete?
I think that you should avoid dynamic allocation where possible for embedded systems. But I understand that sometimes it’s unavoidable.
If you only have a few dynamic allocations then you could “instrument�? the calls - have wrappers around malloc/free that log the allocations. But that requires a relatively fast logging scheme.
Something I found useful was to be able to explore the heap and inspect any allocations that hadn’t been freed. In my case I reverse-engineered the heap code to add such a routine as full source was available. But your development system might provide that as standard.
Hope this helps,
Danish
PS: one further thought - do you have just the one thread (and no allocations in interrupts) or is your code multi-threaded with or without RTOS