Issue #73 resolved

DatabaseMetaData.getTables() Memory Leak

Grace Batumbya
created an issue


Taro/Grace- I found a pretty significant memory leak when calling this routine:

        java.sql.DatabaseMetaData dbmd = conn.getMetaData();
        java.sql.ResultSet rs = dbmd.getTables(null,null,null,new String[]{"TABLE"});

        rs = null;

I found that this chuck of code eats up approximately 10KB of RAM and is never released. After several thousand iterations (e.g. web app), this can really add up.

After a little digging, I think I have tracked down the source of the problem. In org.sqlite.MetaData.getTables() a statement is created but never closed. Example:

        return conn.createStatement().executeQuery(sql);