Hi, I am developping on a SAML 21J18A board, and I would like to know if there is any tools/ways to debug memory leakage, like Valgrind does for regular C programs ?
You aren't going to find anything like Valgrind for a micro (well not until you reach the level where the micros themselves are running Linux). The best bet is to ad code to the C start-up that floods RAM with some known byte then look for signs of usage after the code has been run.
(BTW I'll move this to an ARM forum)
Ok, thanks for the advice, but I don't really see how it would work. How are you usually debugging memory leaks or how do you ensure that there is no leaks in your code ?
One good strategy is simply never using dynamic memory allocation (in an embedded/micro) project. I can't think of a case where that would be a hindrance. Of course some clib calls might do this, but you can usually presume those to be somewhat 'safe'. C++ is also more trouble then its worth on this class of device. If you are leaking memory you'll probably crash pretty quick. 32K doesn't go very far. Even with no leaks you may well crash due to fragmentation. No dynamic memory, no leaks. Simple.
Thanks for the answer, Colin, we will try to improve that.
© 2018 Microchip Technology Inc.