[osg-users] osg::Switch node can't free memory

Robert Osfield robert.osfield at gmail.com
Mon May 30 00:00:40 PDT 2016

Hi John,

The osg::Switch doesn't delete subgraphs when you toggle children
on/off, it simply disables the traversal of the "off" children.  A
switch is for switching between one or more children where the change
is not permanent, i.e. children may be switch on/off through the
lifetime of the application.

You can't hide your model and free memory associated with it withought
removing it from the scene graph completely.  Group::removeChild() is
the method you want to use.


On 30 May 2016 at 03:21, John Lee <357059570 at qq.com> wrote:
> Hi all!
> I add a model to the osg::Switch node and set it on. And it goes well in OSG window. But when I turn the switch node to off,  the model is invisible while the memory still not free. Can anyone tell me why it happen? Or is there any way that I can hide my model and free memory dynamically?
> Thank you!
> Cheers,
> John
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=67269#67269
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

More information about the osg-users mailing list