I found the source of this memory bloat:
IndexedDiskCacheAttributes has a property "maxKeySize" hardcoded at 500000.
When each IndexedDiskCache is initialized, a HashMap and a
SortedPreferentialArray are both initialized with a size of
"maxKeySize" (500k). This uses aproximately 4MB of the heap PER
IndexedDiskCache.  With 14 regions using an IndexedDiskCache, this
value is 56MB.  So if I had a Heap of 64MB (default, which is what I
used for testing), and 8MB was used for other objects (I'll assume),
initializing these 14 regions put me over the limit of the Heap.

Question is, why does the IndexedDiskCache need 4MB of memory for each
instance? This seems grossly bloated. And why is there no way to
configure the "maxKeySize" for an IndexedDiskCache at least?  If the
HashMap and SortedPreferentialArray need to be initialized to that
amount for efficiency,  then the size should be configurable so it
doesn't take up so much memory unnecessarily.

I apologize for posting in both lists, but JCS users should be aware
of this problem.


On Thu, 11 Nov 2004 11:27:25 -0500, Dean Holdren <[EMAIL PROTECTED]> wrote:
> I built JCS from source (using latest code) and I get a
> java.lang.OutOfMemoryError when first accessing a region (I believe
> inside CompositeCacheConfigurator).  This only occurs (for my
> configuration) if I specify more than 13 regions.
> 
> Using a build from 8/20/2003, I can have over *100* regions (that's as
> high as I tested) without this error.
> 
> My test looks like the following:
> **********************************************************
> JCS.setConfigFilename("/myCacheRegions.ccf");
> JCS.getInstance("region1"); //<---fails
> **********************************************************
> 
> myCacheRegions.ccf:
> 
> jcs.default=indexedDiskCache
> jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
> jcs.default.cacheattributes.MaxObjects=100
> jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
> 
> # SYSTEM GROUP ID CACHE
> jcs.system.groupIdCache=indexedDiskCache
> jcs.system.groupIdCache.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
> jcs.system.groupIdCache.cacheattributes.MaxObjects=10000
> jcs.system.groupIdCache.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
> 
> ##### CACHE REGIONS FOR TEST
> 
> jcs.region.indexedRegion1=indexedDiskCache
> jcs.region.indexedRegion1.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
> jcs.region.indexedRegion1.cacheattributes.MaxObjects=100
> jcs.region.indexedRegion1.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
> 
> #####...... (More regions, each configured like above example)
> 
> ##### AUXILIARY CACHES
> 
> # Indexed Disk Cache
> jcs.auxiliary.indexedDiskCache=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
> jcs.auxiliary.indexedDiskCache.attributes=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
> jcs.auxiliary.indexedDiskCache.attributes.DiskPath=c:/cache
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to