=== modified file 'src/enums.h' --- src/enums.h 2011-03-18 11:36:50 +0000 +++ src/enums.h 2011-07-04 10:59:09 +0000 @@ -216,21 +216,23 @@ MEM_CLIENT_INFO, MEM_LINK_LIST, MEM_DLINK_NODE, - MEM_DONTFREE, MEM_DREAD_CTRL, MEM_DWRITE_Q, - MEM_FQDNCACHE_ENTRY, - MEM_FWD_SERVER, MEM_HTTP_HDR_CC, MEM_HTTP_HDR_CONTENT_RANGE, - MEM_IPCACHE_ENTRY, MEM_MD5_DIGEST, MEM_NETDBENTRY, MEM_NET_DB_NAME, MEM_RELIST, + // IMPORTANT: leave this here. pools above are initialized early with memInit() + MEM_DONTFREE, + // following pools are initialized late by their component if needed (or never) + MEM_FQDNCACHE_ENTRY, + MEM_FWD_SERVER, #if !USE_DNSSERVERS MEM_IDNS_QUERY, #endif + MEM_IPCACHE_ENTRY, MEM_MAX } mem_type; === modified file 'src/mem.cc' --- src/mem.cc 2011-06-22 12:21:39 +0000 +++ src/mem.cc 2011-07-04 10:59:43 +0000 @@ -202,6 +202,7 @@ void * memAllocate(mem_type type) { + assert(MemPools[type]); return MemPools[type]->alloc(); } @@ -209,6 +210,7 @@ void memFree(void *p, int type) { + assert(MemPools[type]); MemPools[type]->freeOne(p); } @@ -503,15 +505,13 @@ void memCheckInit(void) { - mem_type t; - - for (t = MEM_NONE, ++t; t < MEM_MAX; ++t) { - if (MEM_DONTFREE == t) - continue; - + mem_type t = MEM_NONE; + + while (++t < MEM_DONTFREE) { /* * If you hit this assertion, then you forgot to add a * memDataInit() line for type 't'. + * Or placed the pool type in the wrong section of the enum list. */ assert(MemPools[t]); }