Hi Nick, This is really something you'd want to use a debug for - just run it and break the app before anything untoward happens.
The code itself looks quite benign on a first reading, the only thing I can think of that might cause a memory issue would be if your scene graph had a circular reference in it so the traversal ends up in an infinite loop. Robert On 9 January 2018 at 12:12, Trajce Nikolov NICK <trajce.nikolov.n...@gmail.com> wrote: > hi Robert, Community, > > I have the following code in a loop against very large quadtree based > database. And this code is eating all the memory, progressively and then the > system kills it . Any clue? > > Thanks a lot > > osg::ref_ptr<osgUtil::LineSegmentIntersector> picker; > osg::ref_ptr<osgUtil::IntersectionVisitor> iv; > > osg::Vec3d getHOT(const osg::Vec3d& position, osgViewer::CompositeViewer& > viewer, osg::Vec3& normal, bool& valid) > { > osg::Vec3d result; > > osg::EllipsoidModel em; > osg::Vec3d up = em.computeLocalUpVector(position.x(), position.y(), > position.z()); > up.normalize(); > > osg::Vec3d s = position + up * 100; > osg::Vec3d e = osg::Vec3d(0, 0, 0); > > if (viewer.getView(0)->getSceneData()) > { > #if 1 > if (!picker.valid()) > { > picker = new osgUtil::LineSegmentIntersector(s,e); > iv = new MyIntersectionVisitor(RANGE); > } > picker->setStart(s); > picker->setEnd(e); > picker->getIntersections().clear(); > iv->setIntersector(picker); > iv->reset(); > iv->setUseKdTreeWhenAvailable(false); > //iv->setLODSelectionMode(osgUtil::IntersectionVisitor::USE_EYE_POINT_FOR_LOD_LEVEL_SELECTION); > viewer.getView(0)->getSceneData()->accept(*iv); > > if (picker->containsIntersections()) > { > osgUtil::LineSegmentIntersector::Intersections hitList = > picker->getIntersections(); > osgUtil::LineSegmentIntersector::Intersections::iterator hit = > hitList.begin(); > > result = hit->getWorldIntersectPoint(); > normal = hit->getWorldIntersectNormal(); > valid = true; > > return result; > } > #endif > } > valid = false; > > return result; > } > > -- > trajce nikolov nick > > _______________________________________________ > osg-users mailing list > osg-users@lists.openscenegraph.org > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org