geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevan Miller <kevan.mil...@gmail.com>
Subject Workaround for URLJarFile memory leak
Date Fri, 11 Nov 2005 16:06:29 GMT
As I mentioned previously, there is a memory leak of URLJarFile instances in
Geronimo. The problem is caused by
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4167874 --
sun.net.www.protocol.jar.JarFileFactory will hold onto strong references to
all URLJarFile instances. So URLJarFiles can never be GCed. This means that
for every deploy/undeploy of an application, you'll leak URLJarFiles.

The problem can be avoided by calling URLConnection.setDefaultUseCaches(false);
This will turn off the caching in JarFileFactory. I added a call to
setDefaultUseCaches() to DeploymentUtil.readAll() and verified that Geronimo
no longer leaks URLJarFile instances.

Note that setDefaultUseCaches(false) is a "global" setting. So it affects
the entire runtime. URLConnection.setUseCaches(false) does not fix the
problem. Since, there is the potential for a performance impact, I thought
I'd advertise the issue. I don't see any usages within Geronimo code where
this would cause major problems. However, there may be issues which I'm not
realizing...

Comments? Barring concerns, I'll raise a Jira and post a patch.

--kevan

Mime
View raw message