We are caching quite a few entities, and are somewhat concerned about running out of memory. Obviously, we could lower the capacity of the entity cache. We were hoping that there might be some JBoss option, that allowed the application server to dynamically shrink cache sizes if too much memory was in use.
I have no basis for believing the application server has access to the garbage collection internals that would allow for this to be determined, but I figured there was no harm in asking. Basically, we want to maximize the number of entities we cache up to a certain percentage of the avaialable memory allocated to the server, and have cache size shrink if the server begins to run out of memory.
Have a look at container-cache-conf in standardjboss.xml. It's not in K/M bytes but in number of instances though.