Andreas Zieringer wrote:
> Hi Allen,
>
>
>> I would like to find a way in OpenSG2 to verify that my application is
>> correctly garbage collecting OpenSG objects after they are no longer
>> needed. What is the suggested way to do this. Right now I considering
>> two options but I don't know how to implement either one.
>>
>> - option 1: notification callback when an fc is changed, created, destroyed
>>
>> I know that it is possible to add callbacks to a remote aspect to let
>> you know when an fc was changed, created, destroyed. Is it possible to
>> do something similar in a local aspect?
>>
>
> via the ChangeList you already get this informations.
>
How? I guess I am missing how I can get a list of deleted fc ids or get
called when a fc is deleted.
>
>> - option 2: examine the fc factory/store
>>
>> Is there a way to ask the FieldContainerFactory how many fc's are
>> currently in memory? If there is then I guess I could monitor this
>> number as a way to see if the fc's are being collected when I think they
>> should.
>>
>
> yes you can walk over the fc list and count all non NullFC entries. Ok
> that's not very fast but we could implement a internal counter. This
> should work for 1.8 don't know about 2.0.
>
I went this route for now and it did prove that fc's are not being
garbage collected in my application. I am still working to track this
down. If anyone is interested, I have included the code I used.
-Allen
OSG::UInt64 getNumAllocatedFieldContainers()
{
OSG::UInt64 num_allocated_fcs(0);
OSG::FieldContainerFactoryBase* fcf = OSG::FieldContainerFactory::the();
const OSG::FieldContainerFactoryBase::ContainerStore&
fcs(fcf->getContainerStore());
for(OSG::UInt64 i=0; i<fcs.size(); i++)
{
OSG::FieldContainerPtr fcp(fcs[i]);
if (fcp != OSG::NullFC)
{
num_allocated_fcs += 1;
}
}
return num_allocated_fcs;
}
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users