Hello Marc,
Marc Hofmann wrote:
> > With only one ref count shared across all aspect copies I'm not sure if
> > this can be fixed in 1.x, I'm currently double checking that it works as
> > expected in 2.0.
>
> I tried to avoid the reference counting problem by cleaning up manually
> before I delete an OpenSG node. That means I set all properties to
> NullFC. In my understanding this should work, because every change is
> now covered by the changelist and therefore correctly handled with 2
> aspects. The printOSGInstances() function shows 0 living FC’s, but
> unfortunately the program still leaks memory. Not as much as before, but
> notable. Are there any other ways to detect living OpenSG nodes?
hm, if the factory shows no living containers they should all be gone, I
can't think of a way a container could be alive without being registered
with the factory.
One source of continuous growth of memory use is in the factory itself,
it keeps a std::vector of FieldContainerPtr to all live containers in
the system (not really a leak, but it eats memory) - in 2.0 we changed
it to a std::deque (and I think common implementations of deque are able
to free blocks in the middle).
Another thing that might grow, is change lists, but I think you take
care of clearing them already, right?
So, in summary I don't think you are leaking containers, but perhaps
some other datastructure (that may well be part of OpenSG). On linux I'd
recommend running your application under valgrind, for windows I'm not
sure what/if other tools can be used.
> For example, this is what I'm doing to delete a ChunkMaterial:
>
> ChunkMaterialPtr mOSGMaterial = ChunkMaterialPtr::dcast(node->getCore());
> beginEditCP(mOSGMaterial);
> while (mOSGMaterial->getChunks().size() > 0)
> {
> StateChunkPtr chunk = mOSGMaterial->getChunks()[0];
> TextureChunkPtr tex_chunk = TextureChunkPtr::dcast(chunk);
> if (tex_chunk != NullFC)
> {
> beginEditCP(tex_chunk->getImage());
> tex_chunk->getImage()->clearData();
> endEditCP(tex_chunk->getImage());
>
> beginEditCP(tex_chunk);
> tex_chunk->setImage(NullFC);
> endEditCP(tex_chunk);
> }
> mOSGMaterial->subChunk(chunk);
> }
> endEditCP(mOSGMaterial);
>
> beginEditCP(node);
> node->setCore(NullFC);
> endEditCP(node);
ok. have you tried just calling subChunk() for each chunk in the
material (together with a fix I committed on Sunday that should be
sufficient) ?
Cheers,
Carsten
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users