Masti,
Define "the resident objects within a given bundle". Your definition
should look something like:
"Object O is said to be resident within bundle B
if --- --- ---
and --- --- ---
etc."
and should be determinable at runtime.
> Hi Chris/BJ,
>
> Thanks for the detailed explanation. I knew if I would ask a question
> here I would get a straight and direct answer!
>
> 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.
>
> -Thanks
> Masti
>
>
> ________________________________
> From: "[email protected]" <[email protected]>
> To: OSGi Developer Mail List <[email protected]>
> Sent: Friday, November 18, 2011 4:17 AM
> Subject: Re: [osgi-dev] Question about Memory Usage per Bundle
>
> BJ is right, the quantity you are trying to measure is not well-defined.
> We were able to modify the Mika VM to associate each allocation with the
> most local non-system class loader on the stack at the time of allocation,
> which gives an answer to the question "how much memory has this bundle
> allocated which has not yet been reclaimed by GC", for one possible
> definition of "memory is allocated by a bundle". But if a bundle were
> generating objects which should be short-lived, but some other bundle is
> obsessively cacheing them then our system would "blame" the first bundle
> when in fact it is the second which is the real culprit.
>
> Carrying out measurements when the bundle is loaded/started is probably
> not very realistic either, I wouldn't expect many Java modules to allocate
> all the memory they need at startup time. For that you should be looking
> at something like Fortran (prior to Fortran 90).
>
> --
> Chris Gray
>
>> How do you define how much memory a bundle uses? It is generally not
>> possible to do this unless you have a very specific definition of memory
>> use. Bundles can extend classes imported from other bundles. Bundles can
>> call other bundles which allocate memory for the caller. To which bundle
>> does this memory "belong"? A bundle is a unit of encapsulation and
>> classloader isolation but it is not a unit of memory isolation. From a
>> memory perspective, bundles are very intertwined and it is extremely
>> hard
>> to try and disentangle them.
>>
>> --
>>
>> BJ Hargrave
>> Senior Technical Staff Member, IBM
>> OSGi Fellow and CTO of the OSGi Alliance
>> [email protected]
>>
>> office: +1 386 848 1781
>> mobile: +1 386 848 3788
>>
>>
>>
>>
>>
>> From: masti whoknows <[email protected]>
>> To: "[email protected]" <[email protected]>,
>> Date: 2011/11/17 12:51
>> Subject: [osgi-dev] Question about Memory Usage per Bundle
>> Sent by: [email protected]
>>
>>
>>
>> Hi,
>>
>> I am using OSGi to create a plug & play framework. My goal is to
>> measure how much memory each bundle is using. Is there a way to do this
>> dynamically when the bundle is loaded/started? Please note I don't want
>> to
>> use any external tools. I want to do it while the system is running.
>>
>> Any help is highly appreciated.
>>
>> Thanks
>> Masti_______________________________________________
>> OSGi Developer Mail List
>> [email protected]
>> https://mail.osgi.org/mailman/listinfo/osgi-dev
>> _______________________________________________
>> OSGi Developer Mail List
>> [email protected]
>> https://mail.osgi.org/mailman/listinfo/osgi-dev
>
>
> _______________________________________________
> OSGi Developer Mail List
> [email protected]
> https://mail.osgi.org/mailman/listinfo/osgi-dev_______________________________________________
> OSGi Developer Mail List
> [email protected]
> https://mail.osgi.org/mailman/listinfo/osgi-dev
_______________________________________________
OSGi Developer Mail List
[email protected]
https://mail.osgi.org/mailman/listinfo/osgi-dev