[kf-users] Classloader leaks: "java.lang.OutOfMemoryError: PermGen space" error
Jose Fermin Alvarez
josefermin.alvarez at gmail.com
Fri Apr 10 22:10:54 CEST 2009
Hi all, I have used Knopflerfish 2.0.2/JDK 1.5/ OSX 10.5 to write an
container application where independent applications, formed by a set of
OSGi bundles, are installed/uninstalled. After several
deployment/undeployment cycles, it runs into problem of PermGem out of space
Analyzing the Heap dump with Eclipse Memory Analyzer, It seems to me the
application runs out of perm space because of leaking class loaders in
Knopflerfish framework. The org.knopflerfish.framework.BundleClassLoader
aren't be garbage collected because there is a class,
org.knopflerfish.framework.Pkg, that mantains a reference to them.
It seems to me the org.knopflerfish.framework.Pkg class is used by
Knopflerfish to represents a java package and it mantains a reference to all
bundleClassLoaders that imports the represented package. The problem is Pkg
mantains the reference even the bundles are uninstalled
I couldn't find any information in OSGi specification about when and how the
framework should removes any reference to the bundle classloader in order to
make them "unreachable" so they can be garbage collected.
Why does the framework maintain references to uninstalled
bundles/classloaders? Am I missing something in the OSGi specification or
Knopflefish behaviour? Is there a way to force the framework to remove the
reference to uninstalled bundles/classloaders?.
I'd really appreciate any advice to resolve the ClassLoader leak, because
increasing perm space will only help for so long.
Thanks
Jose Fermin Alvarez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.knopflerfish.org/pipermail/knopflerfish-users/attachments/20090410/356497a5/attachment.html>
More information about the Knopflerfish-users
mailing list