Low memory ehcache

I am using ehcache 1.2.3. Since the size of the cache is specified in terms of "elements", the memory used by the cache can vary greatly (ehcache is used with hibernate and also contains a standard request cache, in which requests return results from a size that can vary). My question is: what happens if the JVM becomes out of memory. my impression of reading the ehcache change log is that it originally used soft links, but since java 1.4 cleared them aggressively, soft links were eventually dropped. So if the cache gets too big, would I just get an OutOfMemoryError? Nothing in Ehcache trying to prevent this?

+5
source share
1 answer

You are right that if you want to create OOM with ehcache, you can do it. You looked at the calibration options, though, like maxEntriesLocalHeap / maxBytesLocalHeap. Using them, you can effectively prevent the use of caches of more than the allocated memory.

See for example http://ehcache.org/documentation/configuration/cache-size

+1
source

All Articles