int magic;
};
-int mallocs,malloc_size,malloc_size_m;
+int mallocs,debug_malloc_size,debug_malloc_size_m;
void
debug_dump_mallocs(void)
if (!size)
return NULL;
mallocs++;
- malloc_size+=size;
- if (malloc_size/(1024*1024) != malloc_size_m) {
- malloc_size_m=malloc_size/(1024*1024);
- dbg(0,"malloced %d kb\n",malloc_size/1024);
+ debug_malloc_size+=size;
+ if (debug_malloc_size/(1024*1024) != debug_malloc_size_m) {
+ debug_malloc_size_m=debug_malloc_size/(1024*1024);
+ dbg(0,"malloced %d kb\n",debug_malloc_size/1024);
}
head=malloc(size+sizeof(*head)+sizeof(*tail));
head->magic=0xdeadbeef;
mallocs--;
head=(struct malloc_head *)((unsigned char *)ptr-sizeof(*head));
tail=(struct malloc_tail *)((unsigned char *)ptr+head->size);
- malloc_size-=head->size;
+ debug_malloc_size-=head->size;
if (head->magic != 0xdeadbeef || tail->magic != 0xdeadbef0) {
fprintf(stderr,"Invalid free from %s:%d %s\n",where,line,func);
}