Hello Allen,

Allen Bierbaum wrote:
> We were sitting down yesterday trying to think about where our memory
> is going and I have a question.
> 
> If an application has 2 aspects, one in a background loader thread and
> the other in a foreground rendering thread, what happens to memory
> usage if the background thread loads an image, model, etc and then
> syncs it to the foreground?

before the sync the image data only exists in the loader aspect, after 
the sync the both aspects point to the same data until you start to 
modify it in an aspect at which point a copy is generated. In other 
words it implements copy on write.

> In other words, are there 2 copies sitting around of the raw image
> data in memory?  Similarly, are there multiple copies of models that
> get loaded in the background thread and synced to the foreground?

not if the model is never modified after the sync. Note that:

img->editMFPixel()->size();

"modifies" the image, i.e. it creates the copy.

> Another question about detecting this, does the MemoryConsumption
> helper class track down memory usage across multiple aspects.  For
> example if multiple copies of an fc are held across contexts, does it
> count up all the copies or just one per fc?

It only counts a single aspect copy.

        Cheers,
                Carsten


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to