Subject | Re: ResultSet memory issue |
---|---|
Author | rockxwre |
Post date | 2005-01-18T09:15:19Z |
Anyone? :-) I'm using the latest driver...
--- In Firebird-Java@yahoogroups.com, Ramon Rockx <rockxwre@y...>
wrote:
--- In Firebird-Java@yahoogroups.com, Ramon Rockx <rockxwre@y...>
wrote:
>ResultSet is
> Hi all,
>
> Does anybody know when the memory which is reserved for a
> released?email) on
> When I run a piece of code (which can be found on the end of this
> a table with 10000 records itresultset is
> gives the following result:
>
> Autocommit: true
> Memory before selects 413 kB
> Memory after selects 186787 kB
> Memory after close connection 186787 kB
>
> What I expected was that the memory would be released after the
> closed. However, even when the connection is closed, the memory isnot
> released.("jdbc:firebirdsql:localhost/3050:D:\\memorytest.fdb",
>
> Can somebody help me out with this?
>
> Regards,
>
> Ramon Rockx
>
>
> public static void testSQL() {
> try {
> long memoryBeforeSelects;
> long memoryAfterSelects;
> long memoryAfterConnectionClose;
>
> Class.forName("org.firebirdsql.jdbc.FBDriver");
> Connection conn =
> DriverManager.getConnection
> "sysdba", "masterkey");().totalMemory() -
> System.out.println("Autocommit: " + conn.getAutoCommit());
> try {
> Statement stmt = conn.createStatement();
> stmt.setFetchSize(10);
> try {
> System.gc();
> memoryBeforeSelects = Runtime.getRuntime
> Runtime.getRuntime().freeMemory();().totalMemory() -
> ResultSet rs = stmt.executeQuery("SELECT * FROM
> TEST_TABLE");
> rs.close();
> System.gc();
> memoryAfterSelects = Runtime.getRuntime
> Runtime.getRuntime().freeMemory();().freeMemory();
> }
> finally {
> stmt.close();
> }
> }
> finally {
> conn.close();
> System.gc();
> memoryAfterConnectionClose =
> Runtime.getRuntime().totalMemory() - Runtime.getRuntime
> }memoryBeforeSelects /
> System.out.println("Memory before selects " +
> 1024 + " kB");memoryAfterSelects /
> System.out.println("Memory after selects " +
> 1024 + " kB");
> System.out.println("Memory after close connection " +
> memoryAfterConnectionClose / 1024 + " kB");
> }
> catch (Exception ex) {
> ex.printStackTrace();
> }
> }
>
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Meet the all-new My Yahoo! Try it today!
>
> [Non-text portions of this message have been removed]