Hello Patrick,
Patrick Hartling wrote:
> Has anyone ever tried to customize memory allocation of field containers? My
> hope is to address potential memory fragmentation issues resulting from
> frequent allocation and deallocation of field container objects--assuming
> that we do find that to be a problem. Specifically, I am thinking about how
> to change the allocation of custom field containers that are written as
> extensions to OpenSG. I was skimming the code and started thinking about the
> possibility of specializing OSG::FieldContainer::newPtr<T>() for a given
> custom field container type, but maybe it would just be easier (and less
> arcane) to overload new and delete for the types in question.
>
> Ultimately what I need is an extension point for doing this custom memory
> allocation that gets along well with the rest of OpenSG. Does anyone have
> any tips or suggestions? Thanks.
there is a shallowCopy() member function, it is used to clone the
prototypes when a new instance is created (i.e. it is used from
Foo::create()). Since it is virtual you can easily override it on a per
container basis.
Unfortunately it does not give you control over the aspect copies as it
is not used in FieldContainer::newAspectCopy(). Maybe we could call
shallowCopy from there or you could perhaps override createAspectCopy()
for that purpose?
I guess Gerrit has a better understanding of how these things interact
and what the right places to hook into it are.
Cheers,
Carsten
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users