Memory leaks on nrf5340

I am trying to write tests for my code using CppUtest.
I know the platform has memory leaks detection support.
it seems that everyting is set up correctly to see the results of this support.
nevertheless, i dont see any memry detction report after creating ones.
did anybody encounter a similer issue? is there any other way to detect memory leaks in c/cpp code running on nrf5340dk?
 

  • To detect memory leaks, dynamic code analysis is required. There are several tools available for this purpose, such as Valgrind, or the address and thread sanitizers provided by Clang and GCC. However, these tools require the code to be run on a PC because they introduce a significant number of additional instructions. For example, Valgrind runs the code in a "sandbox," which demands more memory than is typically available on Nordic MCUs.

    Currently, there aren't any effective tools for detecting memory leaks directly on an MCU. While you can implement workarounds, such as adding metadata to allocated and deallocated memory blocks, these methods won't catch all errors. The best approach is to write your code in a way that makes it easily portable to other platforms, like a PC. You can then isolate the sections of code that may cause problems, refactor them to compile on a PC, and run them using Valgrind or address sanitizers to detect any memory leaks.

Related