diff -N -c -r -X exclude_files squid-1.0.beta8/include/util.h squid-1.0.beta8.henrik/include/util.h *** squid-1.0.beta8/include/util.h Fri May 10 01:20:44 1996 --- squid-1.0.beta8.henrik/include/util.h Tue May 21 22:14:41 1996 *************** *** 41,46 **** --- 41,49 ---- char *xstrdup _PARAMS((char *)); char *xstrerror _PARAMS((void)); char *getfullhostname _PARAMS((void)); + #if XMALLOC_STATISTICS + void malloc_statistics _PARAMS((void(*)(int,int,void *),void *)); + #endif /* from debug.c */ #ifndef MAX_DEBUG_LEVELS diff -N -c -r -X exclude_files squid-1.0.beta8/lib/util.c squid-1.0.beta8.henrik/lib/util.c *** squid-1.0.beta8/lib/util.c Fri May 17 23:14:44 1996 --- squid-1.0.beta8.henrik/lib/util.c Tue May 21 22:37:29 1996 *************** *** 21,26 **** --- 21,59 ---- extern char *sys_errlist[]; #endif + #if XMALLOC_STATISTICS + #define DBG_MAXSIZE (1024*1024) + #define DBG_GRAIN (16) + #define DBG_MAXINDEX (DBG_MAXSIZE/DBG_GRAIN) + #define DBG_INDEX(sz) (sz 0) { /* parent */ --- 142,148 ---- if ((pid = fork()) < 0) { debug(14, 0, "ipcache_create_dnsserver: fork: %s\n", xstrerror()); close(cfd); ! free(socketname); return -1; } if (pid > 0) { /* parent */ *************** *** 151,164 **** /* open new socket for parent process */ if ((sfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { debug(14, 0, "ipcache_create_dnsserver: socket: %s\n", xstrerror()); ! xfree(socketname); return -1; } fcntl(sfd, F_SETFD, 1); /* set close-on-exec */ memset(&addr, '\0', sizeof(addr)); addr.sun_family = AF_UNIX; strcpy(addr.sun_path, socketname); ! xfree(socketname); if (connect(sfd, (struct sockaddr *) &addr, sizeof(addr)) < 0) { close(sfd); debug(14, 0, "ipcache_create_dnsserver: connect: %s\n", xstrerror()); --- 151,164 ---- /* open new socket for parent process */ if ((sfd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { debug(14, 0, "ipcache_create_dnsserver: socket: %s\n", xstrerror()); ! free(socketname); return -1; } fcntl(sfd, F_SETFD, 1); /* set close-on-exec */ memset(&addr, '\0', sizeof(addr)); addr.sun_family = AF_UNIX; strcpy(addr.sun_path, socketname); ! free(socketname); if (connect(sfd, (struct sockaddr *) &addr, sizeof(addr)) < 0) { close(sfd); debug(14, 0, "ipcache_create_dnsserver: connect: %s\n", xstrerror()); diff -N -c -r -X exclude_files squid-1.0.beta8/src/main.c squid-1.0.beta8.henrik/src/main.c *** squid-1.0.beta8/src/main.c Fri May 17 18:28:36 1996 --- squid-1.0.beta8.henrik/src/main.c Tue May 21 21:27:37 1996 *************** *** 303,312 **** #endif #ifdef M_MXFAST /* biggest size that is considered a small block */ ! mallopt(M_MXFAST, 4096); #endif #ifdef M_NBLKS ! /* number of holding small block */ mallopt(M_NLBLKS, 100); #endif #endif /* HAVE_MALLOPT */ --- 303,312 ---- #endif #ifdef M_MXFAST /* biggest size that is considered a small block */ ! mallopt(M_MXFAST, 512); #endif #ifdef M_NBLKS ! /* number of blocks in each chunk */ mallopt(M_NLBLKS, 100); #endif #endif /* HAVE_MALLOPT */ diff -N -c -r -X exclude_files squid-1.0.beta8/src/stat.c squid-1.0.beta8.henrik/src/stat.c *** squid-1.0.beta8/src/stat.c Mon May 20 21:47:22 1996 --- squid-1.0.beta8.henrik/src/stat.c Tue May 21 21:59:43 1996 *************** *** 465,470 **** --- 465,483 ---- + #if XMALLOC_STATISTICS + void info_get_mallstat(size, number, sentry) + int size,number; + StoreEntry *sentry; + { + static char line[MAX_LINELEN]; + if(number>0) { + sprintf(line,"{\t%d = %d}\n",size,number); + storeAppend(sentry, line, strlen(line)); + } + } + #endif + void info_get(obj, sentry) cacheinfo *obj; StoreEntry *sentry; *************** *** 754,761 **** --- 767,781 ---- meta_data.url_strings) >> 10); storeAppend(sentry, line, strlen(line)); + #if XMALLOC_STATISTICS + sprintf(line, "{Memory allocation statistics}\n"); + storeAppend(sentry, line, strlen(line)); + malloc_statistics(info_get_mallstat,sentry); + #endif + storeAppend(sentry, close_bracket, strlen(close_bracket)); } + void parameter_get(obj, sentry)