Search code examples
javajdbcbea

Out of Memory allocLargeObjectOrArray from ResultSet


I'm using JDBC to get a large amount of data. The call completes successfully, but when resultSet.next() is called, I get the following error:

java.lang.OutOfMemoryError: allocLargeObjectOrArray - Object size: 15414016, Num elements: 7706998

I've attempted to increase the JVM memory size, but this does not fix the problem. I'm not sure this problem can even be addressed as I'm not using JDBC to access a database, rather, the system is accessing a BEA AquaLogic service through JDBC.

Has anyone run into this error?


Solution

  • Beware that until the first resultSet.next() call the results may not yet be read from the database or still be in another caching structure somewhere.

    You should try limit your Select to return a sane amount of results and maybe repeat the call until there are no more results left if you need all the data.

    Increasing the JVM memory size won't help unless you can be sure that there is an absolute limit on the amount of data which will be returned by your JDBC call.

    Furthermore, accessing any service through JDBC essentially boils down to using JDBC :)

    Another (unlikely) possibility could be that there is a bug in the JDBC driver you're using. Try a different implementation if it is possible and check if the problem persists.