You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Knut Anders Hatlen (JIRA)" <de...@db.apache.org> on 2006/08/22 15:02:15 UTC

[jira] Resolved: (DERBY-23) just booting jdbc driver and shutting down seem to leak memory

     [ http://issues.apache.org/jira/browse/DERBY-23?page=all ]

Knut Anders Hatlen resolved DERBY-23.
-------------------------------------

    Resolution: Fixed

I'm marking this issue as resolved.

The reason why I haven't resolved it before, is that I still see OutOfMemoryError on some platforms. These errors are caused by the background threads running with a lower priority than the the main thread, and therefore many of the background threads don't get enough CPU time to shut down. If the main thread takes a break now and then, I don't see OutOfMemoryError on any platform. That is,

    while (true) {
        Class.forName("org.apache.derby.jdbc.EmbeddedDriver").newInstance();
        DriverManager.getConnection("jdbc:derby:;shutdown=true");
        Thread.sleep(1);
    }

runs reliably with no memory leak on all platforms I have tested. I don't want to add a regression test for this issue, since I fear it will be timing dependent and might cause noise in the nightly testing.

I think the issue can be closed because the remaining problem is unlikely to be seen in a real-world application (who will spend all their CPU time on loading and unloading the driver?). If it turns out to be a problem, I see these possible solutions:

  1) On shutdown, wait for all background threads to terminate.
  2) On shutdown, raise the priority of the background threads.

If someone feels this should be addressed, please open a new issue.

> just booting jdbc driver and shutting down seem to leak memory
> --------------------------------------------------------------
>
>                 Key: DERBY-23
>                 URL: http://issues.apache.org/jira/browse/DERBY-23
>             Project: Derby
>          Issue Type: Bug
>          Components: Services
>    Affects Versions: 10.0.2.0
>            Reporter: Tulika Agrawal
>         Assigned To: Knut Anders Hatlen
>            Priority: Minor
>             Fix For: 10.2.1.0
>
>         Attachments: DERBY-23-npe.diff, DERBY-23-npe.stat, DERBY-23-with_comments.diff, DERBY-23.diff, DERBY-23.stat, derbyall_report.txt
>
>
> Reporting for Daniel John Debrunner.
> Doing simple boot and shutdown of the driver in a loop
> seem to grow the heap forever:
> new org.apache.derby.jdbc.EmbeddedDriver(); //boot the driver
> DriverManager.getConnection("jdbc:derby:;shutdown=true"); 
> //shutdown the cloudscape instance completely
> after booting and shutting down 1516 times, memory used is  
> ~~41931056 bytes.
> Sample GC Output:
> 1931.93: [Full GC 43484K->43243K(65088K), 0.1779751 secs]
> 1933.13: [Full GC 43511K->43270K(65088K), 0.1914383 secs]
> 1934.47: [Full GC 43538K->43297K(65088K), 0.1808878 secs]
> 1935.68: [Full GC 43564K->43324K(65088K), 0.4461623 secs]
> 1937.43: [Full GC 43591K->43350K(65088K), 0.1842980 secs]
> 1938.63: [Full GC 43617K->43377K(65088K), 0.1873431 secs]
> 1939.85: [Full GC 43644K->43404K(65088K), 0.1948505 secs]
> 1941.07: [Full GC 43671K->43430K(65088K), 0.1790895 secs]

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira