Hello,
I'm experiencing OutOfMemoryError in my application, and it's almost always caused by calling one query too many times. For some reason, the statements executed by that query do not get garbage collected. Note: it is not one instance of this query that causes OutOfMemoryError, it is a memory leak that builds up until the application runs out of memory.
Here's the setup:
- using
JBoss connection pooling with Oracle oracle.jdbc.OracleDriver
- default statement cache size
- non-scrollable and non-updatable result sets
- standard query access: build the statement, execute the statement, create a new object, populate the object with data that is retrieved from the result set, close the result set, close the statement, release the connection
I've tried many things to narrow down the cause, none of which changed the problem:
- reverted to my custom connection pooling (this ruled out JBoss connection pooling as the cause)
- set the statement cache size to 0 (this ruled out statement caching as the cause)
- verified that the result sets are non-scrollable and non-updatable (this ruled out Oracle caching large amounts of data on the client)
I've posted a screenshot of a heap dump that shows the object allocation here:
Heap Dump Screenshot I do not know what the JVMPI_GC_ROOT_MONITOR_USED means, but others have mentioned that it probably means the GC thinks these objects are definitely referenced, so it will not garbage collect them. I've verified that other queries in my application do not cause this memory leak.
Any help would be greatly appreciated!