/* new memory functions */ #define MEMTBLSIZE 768 #undef DEBUG #include extern int serv; unsigned memused=0; #ifdef DEBUG struct { void *ptr; int size; char file[20]; int line; } memtbl[MEMTBLSIZE]; #endif /* initialize the memory structure */ void init_mem() { #ifdef DEBUG int i; for (i=0; i60) { sofar[strlen(sofar)-1]=0; tprintf(z,"%s\n",sofar); sofar[0]=0; } } if (sofar[0]) { sofar[strlen(sofar)-1]=0; tprintf(z,"%s\n",sofar); } tprintf(z,"--- End of debug memory list.\n"); #else tprintf(z,"Compiled without extensive memory debugging (sorry).\n"); #endif } void *n_malloc(size,file,line) int size,line; char *file; { void *x; int i; #ifdef DEBUG x=(void *)malloc(size); if (x==NULL) { console("*** FAILED MALLOC %s (%d)",file,line); return NULL; } for (i=0; (i