Hello Olavo,

Olavo Belloc wrote:
> Hi,
> 
> The following message was posted some time ago, but it seems quite
> surprising to me!... =)
> 
> Does it mean that I should avoid creating and erasing FieldContainers
> repeatedly? If somehow, my algorithms end up creating and erasing FC's (let
> say.. every frame), am I going on memory leak?
> Is this the expected behaviour for version 1.8 and 2.0 of OpenSG?

yes, it is expected. For this to actually be a problem

std::vector<FieldContainerPtr> _fcStore;
_fcStore.capacity() * sizeof(FieldContainerPtr)

would have to be large enough that your application data does not fit
into memory any more. This could happen when you create large numbers of
objects per frame.

> Is there another way to overcome this issue? Like cleaning the changelist
> once in a while?

Cleaning changelists or leaving them read only when running single
threaded/non-cluster apps is going to help. But there is currently no
way to prevent the std::vector<FieldContainerPtr> inside the
FieldContainerFactory from growing. We could replace this vector with
another data structure, with size proportional to the non-NullFC
entries, but preferably it should offer lookup performance very close to
that of a vector.
If it becomes a problem for your code, I would suggest implementing a
simple reuse strategy for objects.

> Its not clear to me, why the FieldContainerFactory should be aware of every
> FieldContainer instance of the program. Could somebody clarify that to me?
> =)

It turned out to be quite convenient, there are a couple of places that
need to obtain a FieldContainerPtr to a FC from its id. The cluster
support uses this heavily since pointers only make sense on one machine,
so pointers are transmitted as the id of the pointed to container.

        Hope it helps,
                Carsten



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to