Using Valgrind to debug with flag LE_MEM_VALGRIND


#1

I want to be able to identify any memory leaks in my code, so ideally I could use Valgrind. The Legato Reference Manual mentions that there is a build flag called LE_MEM_VALGRIND which, from the manual:

“When LE_MEM_VALGRIND is enabled, the pools are disabled and instead malloc and free are directly used. Thus enabling the use of tools like Valgrind.” Page 246

The problem is I can’t find where I would enable this build flag, and there is no example on how to use it inside the manual.

The code I’m debugging only uses calloc()/malloc() and free(), it does not use le_mem_ForceAlloc() or anything from the legato API. Given this, does that mean I am not using memory pools whatsoever? Is it recommended to use memory pools and if I implement them would I then be able to see memory leaks? Or is there a simple way to use this flag so I can continue on to use valgrind and not have to change too much of my code?

Thank you.