I am investigating memory leak related to hot deployment of Rails
application on GlassFish. One of the hanging references is the JDBC driver,
in this case: org.sqlite.JDBC. The class loader is
org.jruby.util.JRubyClassLoader.

I tried to fix it by trying to do something like this:

            for (Enumeration e = DriverManager.getDrivers();
e.hasMoreElements();) {
                Driver driver = (Driver) e.nextElement();
                if (driver.getClass().getClassLoader() ==
getClass().getClassLoader()) {
                    DriverManager.deregisterDriver(driver);
                }
            }

This does not work because DriverManager.getDrivers() returns only the
drivers loaded by this classloader so org.sqlite3.JDBC is not even reported
although in the debugger I can see it very well and its loaded by
JRubyClassLoader.

So the right fix will be in Ruby.tearDown() to do what I am trying to do
using JRubyClassLoader loaded class.

I have opened a JIRA: http://jira.codehaus.org/browse/JRUBY-4226

-vivek.

Reply via email to