|
|
1.1 ! root 1: int mallocinit = 0; ! 2: FILE *mallocfp; ! 3: ! 4: char *emalloc(n) ! 5: int n; ! 6: { char *p; ! 7: if (mallocinit == 0) { ! 8: mallocinit = 1; ! 9: mallocfp = fopen("/tmp/malloc.hist", "w"); ! 10: } ! 11: p = malloc((unsigned) n); ! 12: if (p == NULL) fatal("out of memory"); ! 13: fprintf(mallocfp, "m\t%d\t%d\n", (int) p, n); ! 14: return p; ! 15: } ! 16: ! 17: efree(p) ! 18: char *p; ! 19: { fprintf(mallocfp, "f\t%d\n", (int) p); ! 20: free(p); ! 21: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.