--------------------- PatchSet 2218 Date: 2001/05/04 20:35:38 Author: akroonmaa Branch: chunked_mempools Tag: (none) Log: fix segments Members: doc/Programming-Guide/prog-guide.sgml:1.10.8.5->1.10.8.6 Index: squid/doc/Programming-Guide/prog-guide.sgml =================================================================== RCS file: /cvsroot/squid-sf//squid/doc/Programming-Guide/prog-guide.sgml,v retrieving revision 1.10.8.5 retrieving revision 1.10.8.6 diff -u -r1.10.8.5 -r1.10.8.6 --- squid/doc/Programming-Guide/prog-guide.sgml 4 May 2001 18:32:58 -0000 1.10.8.5 +++ squid/doc/Programming-Guide/prog-guide.sgml 4 May 2001 20:35:38 -0000 1.10.8.6 @@ -2,7 +2,7 @@
Squid Programmers Guide Duane Wessels, Squid Developers -$Id: prog-guide.sgml,v 1.10.8.5 2001/05/04 18:32:58 hno Exp $ +$Id: prog-guide.sgml,v 1.10.8.6 2001/05/04 20:35:38 akroonmaa Exp $ Squid is a WWW Cache application developed by the National Laboratory @@ -3050,6 +3050,7 @@

Typical usage could be: + ... myStructType *myStruct; MemPool * myType_pool = memPoolCreate("This is cute pool", sizeof(myStructType)); @@ -3058,6 +3059,7 @@ ... memPoolFree(myStruct, myType_pool); memPoolDestroy(&myType_pool) + memPoolIterate @@ -3080,11 +3082,13 @@ Get next pool pointer, until getting NULL pointer.

+ MemPoolIterator *iter; for (iter = memPoolIterate(); (pool = memPoolIterateNext(iter)); ) { ... handle(pool); } memPoolIterateDone(&iter); + memPoolIterateDone @@ -3136,7 +3140,7 @@ Fills MemPoolStats struct with statistical data about pool. As a return value returns number of objects in use, ie. allocated.

- + struct _MemPoolStats { MemPool *pool; const char *label; @@ -3172,6 +3176,7 @@ mgb_t gb_osaved; /* history Allocations */ mgb_t gb_freed; /* account Free calls */ }; + memPoolGetGlobalStats @@ -3185,6 +3190,7 @@ usage for all pools. As a return value returns number of pools that have at least one object in use. Ie. number of dirty pools.

+ struct _MemPoolGlobalStats { MemPoolMeter *TheMeter; @@ -3204,7 +3210,7 @@ int tot_overhead; int mem_idle_limit; }; - + memPoolClean @@ -3213,21 +3219,25 @@ memPoolClean(time_t maxage); -

+

Main cleanup handler. For MemPools to stay within upper idle limits, this function needs to be called periodically, preferrably at some constant rate, eg. from Squid event. It looks through all pools and chunks, cleans up internal states and checks for releasable chunks. +

Between the calls to this function objects are placed onto internal cache instead of returning to their home chunks, mainly for speedup purpoase. During that time state of chunk is not known, it is not known whether chunk is free or in use. This call returns all objects to their chunks and restores consistency. +

Should be called relatively often, as it sorts chunks in suitable order as to reduce free memory fragmentation and increase chunk utilisation. +

Parameter maxage instructs to release all totally idle chunks that have not been referenced for maxage seconds. +

Suitable frequency for cleanup is in range of few tens of seconds to few minutes, depending of memory activity. Several functions above call memPoolClean internally to operate on