mirror of
https://gitee.com/Vancouver2017/luban-lite-t3e-pro.git
synced 2025-12-14 02:18:54 +00:00
31 lines
582 B
C
31 lines
582 B
C
#include <rtthread.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <avn_mem.h>
|
|
|
|
|
|
// memory leaks (and other bugs) spotter.
|
|
// keeps track of malloc(), free(), calloc() and realloc() calls count and of what
|
|
// happens to the allocated memory.
|
|
|
|
|
|
int memleak_check_example(int argc, char const *argv[])
|
|
{
|
|
leak_info li;
|
|
|
|
aic_mem_leak_init(&li);
|
|
|
|
void *mem = malloc(10);
|
|
if (mem == RT_NULL) {
|
|
return -1;
|
|
}
|
|
aic_mem_leak_peek();
|
|
|
|
// free(mem);
|
|
aic_mem_leak_get_info(&li);
|
|
|
|
return 0;
|
|
}
|
|
|
|
MSH_CMD_EXPORT(memleak_check_example, memleak example);
|