File: malloc_debug.c

package info (click to toggle)
vic 2.8ucl4-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 5,864 kB
  • ctags: 9,033
  • sloc: ansic: 56,989; cpp: 44,560; tcl: 5,550; sh: 1,382; perl: 1,329; makefile: 357
file content (21 lines) | stat: -rw-r--r-- 311 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
#include <stdlib.h>

int malloc_count;
void *debug_malloc(int size)
{
#if 0
    fprintf(stderr,"%d+ ",malloc_count);
#endif
    malloc_count++;
    return malloc(size);
}

void debug_free(void *data)
{
#if 0
    fprintf(stderr,"%d- ",malloc_count);
#endif
    malloc_count;
    free(data);
}