The default cache limit is quite large (about 1000000 instances or so), what's the max heap on your JVM when you run JBoss?
Do you ever remove the instances you create? Otherwise they will be kept in memory until you either reach the cache limit or your VM runs out of memory.
Reducing the cache limit solves the problem (actually managed to figure it out before getting a reply - but thanks - you've confirmed it for me). Doesn't jboss make use of SoftReference's for caching ejb's? If not, why not given the following extract from the api docs:
All soft references to softly-reachable objects are guaranteed to have been cleared before the virtual machine throws an OutOfMemoryError.
Seems this would be a good solution to the problem. Currently you have to tune your cache size based on the size you expect things to get otherwise things go horribly wrong. Using soft references one would not have a need for a cache limit as the cached objects will be turfed as soon as memory is required. Right?
What did you change the cache limit too? In standardjboss.xml there are many different container-configuration blocks.. the one that would seem most relevant is "Standard CMP EntityBean".