4 #include "memory_manage.h"
10 const char *file, *function;
15 static const struct manage EMPTY = {
16 .file = NULL, .line = 0, .function = NULL,
17 .addr = NULL, .size = 0
19 static struct manage management[MANAGE_NUM];
23 for(i = 0; i < MANAGE_NUM; i++){
24 management[i] = EMPTY;
27 void *mm_malloc(const char *file, int line, const char *function, int size)
30 struct manage *t = management;
31 for(i = 0; i < MANAGE_NUM; i++){
33 t->addr = malloc(size);
37 t->function = function;
45 void mm_free(void *addr)
48 struct manage *t = management;
49 for(i = 0; i < MANAGE_NUM; i++){
62 struct manage *t = management;
63 for(i = 0; i < MANAGE_NUM; i++){
65 printf("**free forgot** %s:%d %s() size %d\n", t->file, t->line, t->function, t->size);