John Embretsen wrote:
I haven't seen any details of how you unload the embedded driver,
DriverManager.deregisterDriver(driver) where driver is obtained from
Class.forName.
but
have you tried shutting down the Derby system explicitly as well as (or
instead of) shutting down the particular database?
When I run a small test case (outside of Tomcat) I see the AntiGC thread
hanging around after doing:
- load embedded driver (with newInstance())
Which class has the newInstance() method?
- start the network server using the NetworkServerControl API
- shutdown database (example URL: "jdbc:derby:leakDB;shutdown=true")
- shutdown server (netServerControl.shutdown())
However, when I do:
- load embedded driver (with newInstance())
- start the network server using the NetworkServerControl API
- shutdown Derby system (example URL: "jdbc:derby:;shutdown=true")
- shutdown server (netServerControl.shutdown())
I don't see the AntiGC thread (using jstack).
Ahah! I'm doing method 1 above, not method 2. I think you've hit the
nail on the head, I need to shut down the system, not just the
individual database before shutting down the server.
PermGen space usage seems to be fairly stable at around 11-12 MB even
after several hundred iterations of either of the scenarios mentioned
above, so I'm not able to reproduce your case outside Tomcat (please
post if you are!). I suspect Tomcat may be a part of the problem here...
I suspect you are right - as far as I know Tomcat uses a custom
classloader for each webapp, and PermGen leaks in Tomcat are a
well-known 'feature'.
--
Alan Burlison
--