From pe@iki.fi Sun Aug 3 22:39:10 1997 Date: Sun, 3 Aug 1997 22:38:57 +0300 (EEST) From: Pasi Eronen To: HTDig mailing list Subject: Another MAJOR memory leak... Hi, it's me again... Now that htmerge isn't leaking like a sieve anymore, I turned to htdig. When creating a new database of my documents, htdig used 28.9 MB of memory (total process size given by ps), which is way too much. With the patches below, the memory usage is reduced to 3.9 MB. (The dictionary bug is responsible for most of the leak) All of my patches are also available at . It's now almost 11 PM here in Finland, so I guess this is the last patch today :-) Best regards, Pasi --- Pasi Eronen , +358-50-5123499 *** htlib/Dictionary.cc.orig Fri Feb 7 11:21:43 1997 --- htlib/Dictionary.cc Sun Aug 3 22:20:29 1997 *************** *** 31,36 **** DictionaryEntry::~DictionaryEntry() { ! delete key; delete value; } --- 31,38 ---- DictionaryEntry::~DictionaryEntry() { ! delete [] key; delete value; + if (next) + delete next; } *************** *** 39,42 **** --- 41,46 ---- { value = NULL; // Prevent the value from being deleted + if (next) + next->release(); } *************** *** 68,71 **** --- 72,76 ---- delete table[i]; } + delete [] table; } *************** *** 214,217 **** --- 219,223 ---- } count--; + delete e; return 1; } *************** *** 303,306 **** --- 309,313 ---- } } + delete [] oldTable; } *** htdig/Retriever.cc.orig Sun Aug 3 22:20:08 1997 --- htdig/Retriever.cc Sun Aug 3 22:21:14 1997 *************** *** 184,187 **** --- 184,188 ---- // parse_url(*ref); + delete ref; } }