Karl Pauls wrote:
 In my test case, the framework is responsible for starting the bundles
 (I use autostart property to start the bundles). Could it be the problem?

I don't think so. In the case mentioned above about 50 bundles are
installed using the autostart property and I see classes being
unloaded from the bundles in question.

regards,

Karl

Our scenarios are likely to be different. In my case, the autostart property is making the difference. I can clearly see it when I run my test case in two configurations as described below:

Case 1. I use autostart property to install only the test bundle. In its Activator.start(), the test bundle installs, starts, stops, and uninstalls another bundle called foo. After foo is uninstalled, I force gc to happen. This happens as part of Activator.start() and I see classes from foo bundle getting garbage collected.

Case 2. I use autostart property to install both the test bundle as well as aforementioned foo bundle. In its Activator.start(), the test bundle stops and uninstalls foo bundle. After foo is uninstalled, I force gc to happen. This happens as part of Activator.start(). In this case, I don't see class from foo bundle getting garbage collected.

I later on figured out the reason for this as well. The attached patch solves the issue.

Thanks,
Sahoo

Index: framework/src/main/java/org/apache/felix/framework/Felix.java
===================================================================
--- framework/src/main/java/org/apache/felix/framework/Felix.java       
(revision 628995)
+++ framework/src/main/java/org/apache/felix/framework/Felix.java       
(working copy)
@@ -1145,6 +1145,7 @@
                 // Always release bundle lock.
                 releaseBundleLock(impl);
             }
+            bundles[i] = null; // help garbage collect the bundle
         }
 
         if (m_systemBundleInfo.getState() == Bundle.ACTIVE)

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to