MallocTracer is a tracer for malloc and free operation in C, especially for MCUs, like STM32、NXP、8051...
As C don't have a GC(Garbage Collector), the developer must Malloc and Free memeory manually.However, There is an old Chinese saying:
People can not escape from doing wrong
It's very likely to forget Free a memory after Malloc it, and it will cause Memory Leak.
Although there are a lot of tools for resolving this problem, but most of them are only work in Linux or Windows. This one is for MCUs or RTOS.
It's just use two tables to record your Malloc and Free operation, later you could print the two tables to see
- Where you called Malloc
- The times you called Malloc and Free
- If you Free every memory
Just copy the two files to your project, and add them into your complie toolchain.
TODO: https://community.st.com/s/feed/0D53W00000Cg0y8SAB
1.没有引用<stdio.h>头文件 2.生成keil工程时,会生成两个.c文件