The error you are getting is 'normal' (if you have a look at the JCS code you'll see that an error is raised when no elements are in the memory cache when a 'freeMemoryElements' operation is executed) and can be avoided by implementing this principle:
CompositeCache cc = CompositeCacheManager. getInstance().getCache("myRegion1"); int memorySize = cc.getMemoryCache().getSize(); System.out.println("Entries in memory cache: " + memorySize); if(memorySize>0) { int elementsToFree = 1000; jcs .freeMemoryElements(memorySize<elementsToFree?memorySize:elementsToFree); } By checking the size of the memory cache before calling the 'free' method, you only free if it's actually needed and only as much as possible. This brings us to another issue with your scenario, if you use the MaxObjects=0 setting all data is written to the disk cache immediatly, nothing will be stored in the memory cache anyway. I also noticed that you are using 'myregion' to access the cache region, but your config file defines 'myRegion1'. The result of this is that you get a cache region based on the settings defined in the config file for the default region (which means that you can make changes in the config file for 'myRegion1' as much as you want, it will have no effect).