Menu

java.lang.OutOfMemoryError: GC overhead limit exceeded

Help
logineimer
2015-05-27
2015-05-27
  • logineimer

    logineimer - 2015-05-27

    Hi,

    I tried to connect to a 280MB Access database. Java throws the following error:

    java.lang.OutOfMemoryError: GC overhead limit exceeded
                at java.util.LinkedHashMap.createEntry(LinkedHashMap.java:424)
                at java.util.LinkedHashMap.addEntry(LinkedHashMap.java:406)
                at java.util.HashMap.put(HashMap.java:385)
                at com.healthmarketscience.jackcess.impl.ColumnImpl.setRowValue(ColumnImpl.java:560)
                at com.healthmarketscience.jackcess.impl.TableImpl.getRow(TableImpl.java:672)
                at com.healthmarketscience.jackcess.impl.TableImpl.getRow(TableImpl.java:652)
                at com.healthmarketscience.jackcess.impl.CursorImpl.getCurrentRow(CursorImpl.java:710)
                at com.healthmarketscience.jackcess.impl.CursorImpl$BaseIterator.next(CursorImpl.java:833)
                at com.healthmarketscience.jackcess.impl.CursorImpl$BaseIterator.next(CursorImpl.java:790)
                at net.ucanaccess.converters.LoadJet$TablesLoader.loadTableData(LoadJet.java:764)
                at net.ucanaccess.converters.LoadJet$TablesLoader.loadTablesData(LoadJet.java:928)
                at net.ucanaccess.converters.LoadJet$TablesLoader.loadTables(LoadJet.java:972)
                at net.ucanaccess.converters.LoadJet$TablesLoader.access$2600(LoadJet.java:244)
                at net.ucanaccess.converters.LoadJet.loadDB(LoadJet.java:1361)
                at net.ucanaccess.jdbc.UcanaccessDriver.connect(UcanaccessDriver.java:236)
                at java.sql.DriverManager.getConnection(DriverManager.java:582)
                at java.sql.DriverManager.getConnection(DriverManager.java:154)
                at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:173)
                at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriver(DriverManagerDataSource.java:164)
                at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnectionFromDriver(AbstractDriverBasedDataSource.java:153)
                at org.springframework.jdbc.datasource.AbstractDriverBasedDataSource.getConnection(AbstractDriverBasedDataSource.java:119)
    

    I know that the JVM is spending too much time with collection garbage when this error gets thrown. Nevertheless, I dont't want to turn off this security behavior because the application gets very slow after the error is thrown.

    Greetings

     
  • Marco Amadei

    Marco Amadei - 2015-05-27

    The problem wouldn't be limited to ucanaccess. More in general it's due to your application. See here:http://stackoverflow.com/questions/1393486/error-java-lang-outofmemoryerror-gc-overhead-limit-exceeded
    "The rare cases where I've seen this happen is where some code was creating tons of temporary objects and tons of weakly-referenced objects in an already very memory-constrained environment."
    So, the use of higher values of Xmx or the memory=false parameter, or -XX:-UseGCOverheadLimit (that may imply an excessive amount of CPU taken by the jvm process though) may help to solve.

     
  • logineimer

    logineimer - 2015-05-27

    Thanks for your reply!

    I also read this stackoverflow article. Are you sure, that the problem is due to our application? Using the JDBC/ODBC Bridge never lead to this error.

    Setting singleConnection=true seemed to help solving this issue.

     
  • Marco Amadei

    Marco Amadei - 2015-05-27

    The JDBC/ODBC Bridge doesn't use java in-memory technologies.
    I meant it depends on what you're doing.
    If you're opening more db files, the SingleConnection=true connection parameter gets the resources recovered (i.e. memory) when you close the connection. Because of the bigger free memory, the GC calls are less frequent and more effective. If you're opening a sigle db the SingleConnection=true parameter is irrelevant from this viewpoint: you need higher values of Xmx or the memory=false parameter.

     

Log in to post a comment.