I have modified cache.c which does 3), it is very important because our caches used many entries and all that un-accounted memory (sizeof(Entry)+ sizeof(Tcl_HashEntry)) ate up all memory.
Also i added cache limit by max number of entries in the cache:
static Ns_Cache * CacheCreate(char *name, int keys, time_t timeout,size_t maxSize, size_t maxCount, Ns_Callback *freeProc);
never submitted it.
As for 2), Ns_CacheFlushEntry updates currentSize
David Pautler wrote:
I will probably submit a patch for this, but in case someone else wants to get to it first...
1) Shouldn't Ns_CacheFindEntry and Ns_CacheSetValueSz start by doing Delink() and Push() to update the LRU (least-recently-used) status of the entry?
This is especially important when recovering entries, since only entries with greater LRU can be deallocated to make space, if we are up against the maxSize. In fact, I think Ns_CacheSetValueSz should fail if it can't recover enough space.
2) Shouldn't Ns_CacheMalloc first check that (currentSize < maxSize)? And shouldn't it and Ns_CacheFree update currentSize?
3) Shouldn't the size of each Entry, each Tcl_HashEntry, Tcl_HashTable, and the Cache itself be added to currentSize?
These 3 issues together would allow a cache to far exceed the size limit requested in Ns_CacheCreateSz, it seems.
-dp-
-- AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.
-- Vlad Seryakov 703 488-2173 office [EMAIL PROTECTED] http://www.crystalballinc.com/vlad/
-- AOLserver - http://www.aolserver.com/
To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.