I would like to add that this problem is similar to common Java memory leaks.
When the JVM garbage collector is unable to clear the "waste" memory of your Java / Java EE application over time, OutOfMemoryError: Java heap space will be the outcome.
It is important to perform a proper diagnostic first:
- Enable verbose:gc. This will allow you to understand the memory growing pattern over time.
- Generate and analyze a JVM Heap Dump. This will allow you to understand your application memory footprint and pinpoint the source of the memory leak(s).
- You can also use Java profilers and runtime memory leak analyzer such as Plumbr as well to help you with this task.