>     Maybe the work around (this will give a rough estimate) would be
> to look at the resident objects within a given bundle (include all 
> the objects inside it)? Not sure if that's also possible.

Objects don't reside in bundles. Objects live in the heap. Objects are 
instances of classes.

Classes are loaded from bundles. Classes are composed of a type and the 
super types all of which may be loaded from different bundles.

So which bundle is "responsible" for an object? The bundle from which the 
proximate type was loaded? Or the bundle which did new on the class? It 
seems wrong to blame the bundle from which the type was loaded rather than 
the bundle whose execution actually caused the object to be loaded. And 
what if the bundle which instantiated the object then passes the object to 
a third bundle for its sole use?

Another important issue is aggregation. Very often, objects aggregate 
other objects. For example, a HashMap contains arrays of entries. If a 
bundle "owns" a Map and passes it to another bundle to add things to it, 
and the adding of those entries requires the Map to expand the array, who 
is to be responsible for that memory allocation?

There are huge set of issues on this space that make it very hard to do 
what you want to do. There is a single heap and the objects are 
intertwined. It is not enough to know what bundle loaded the type of an 
object or what bundle did the new. You need to understand the details 
about the specific type to try and make a rational assignment of 
"ownership" of the object.

-- 

BJ Hargrave
Senior Technical Staff Member, IBM
OSGi Fellow and CTO of the OSGi Alliance
hargr...@us.ibm.com

office: +1 386 848 1781
mobile: +1 386 848 3788
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to