<div dir="ltr">Thanks Robert,<div><br></div><div>no circular reference since I am displaying that database in the viewer nicely. Here is the struct (a bit odd but it is as is):</div><div><br></div><div>Group</div><div>|</div><div>PagedLOD PagedLOD PagedLOD .... dozen of these</div><div>|</div><div>Quadtree (similar to VPB generated subtiles)</div><div><br></div><div>I was thinking the visitor is reading all of these by reading all of these PagedLODs without taking the account the range from the eyepoint. So while debuging I tried this:</div><div><br></div><div><div>struct MyIntersectionVisitor : public osgUtil::IntersectionVisitor</div><div>{</div><div><span style="white-space:pre">     </span>MyIntersectionVisitor(float range)</div><div><span style="white-space:pre">            </span>: IntersectionVisitor()</div><div><span style="white-space:pre">               </span>, _range(range)</div><div><span style="white-space:pre">       </span>{</div><div><span style="white-space:pre">     </span>}</div><div><br></div><div><span style="white-space:pre">    </span>virtual void apply(osg::PagedLOD& plod)</div><div><span style="white-space:pre">   </span>{</div><div><span style="white-space:pre">             </span>if (getDistanceFromEyePoint(plod.getCenter(), true) < _range)</div><div><span style="white-space:pre">              </span>{</div><div><span style="white-space:pre">                     </span>osgUtil::IntersectionVisitor::apply(plod);</div><div><span style="white-space:pre">            </span>}</div><div><span style="white-space:pre">     </span>}</div><div><br></div><div>protected:</div><div><span style="white-space:pre">   </span>float _range;</div><div>};</div></div><div><br></div><div>but no luck. Is there a way to  flush all the pending and loaded nodes from the DatabasePager?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 9, 2018 at 1:23 PM, Robert Osfield <span dir="ltr"><<a href="mailto:robert.osfield@gmail.com" target="_blank">robert.osfield@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Nick,<br>
<br>
This is really something you'd want to use a debug for - just run it<br>
and break the app before anything untoward happens.<br>
<br>
The code itself looks quite benign on a first reading, the only thing<br>
I can think of that might cause a memory issue would be if your scene<br>
graph had a circular reference in it so the traversal ends up in an<br>
infinite loop.<br>
<br>
Robert<br>
<br>
On 9 January 2018 at 12:12, Trajce Nikolov NICK<br>
<div><div class="h5"><<a href="mailto:trajce.nikolov.nick@gmail.com">trajce.nikolov.nick@gmail.com</a><wbr>> wrote:<br>
> hi Robert, Community,<br>
><br>
> I have the following code in a loop against very large quadtree based<br>
> database. And this code is eating all the memory, progressively and then the<br>
> system kills it . Any clue?<br>
><br>
> Thanks a lot<br>
><br>
> osg::ref_ptr<osgUtil::<wbr>LineSegmentIntersector> picker;<br>
> osg::ref_ptr<osgUtil::<wbr>IntersectionVisitor> iv;<br>
><br>
> osg::Vec3d getHOT(const osg::Vec3d& position, osgViewer::CompositeViewer&<br>
> viewer, osg::Vec3& normal, bool& valid)<br>
> {<br>
>     osg::Vec3d result;<br>
><br>
> osg::EllipsoidModel em;<br>
> osg::Vec3d up = em.computeLocalUpVector(<wbr>position.x(), position.y(),<br>
> position.z());<br>
> up.normalize();<br>
><br>
> osg::Vec3d s = position + up * 100;<br>
>     osg::Vec3d e = osg::Vec3d(0, 0, 0);<br>
><br>
>     if (viewer.getView(0)-><wbr>getSceneData())<br>
>     {<br>
> #if 1<br>
> if (!picker.valid())<br>
> {<br>
> picker = new osgUtil::<wbr>LineSegmentIntersector(s,e);<br>
> iv = new  MyIntersectionVisitor(RANGE);<br>
> }<br>
> picker->setStart(s);<br>
> picker->setEnd(e);<br>
> picker->getIntersections().<wbr>clear();<br>
> iv->setIntersector(picker);<br>
> iv->reset();<br>
> iv->setUseKdTreeWhenAvailable(<wbr>false);<br>
> //iv->setLODSelectionMode(<wbr>osgUtil::IntersectionVisitor::<wbr>USE_EYE_POINT_FOR_LOD_LEVEL_<wbr>SELECTION);<br>
> viewer.getView(0)-><wbr>getSceneData()->accept(*iv);<br>
><br>
> if (picker-><wbr>containsIntersections())<br>
> {<br>
> osgUtil::<wbr>LineSegmentIntersector::<wbr>Intersections           hitList =<br>
> picker->getIntersections();<br>
> osgUtil::<wbr>LineSegmentIntersector::<wbr>Intersections::iterator hit =<br>
> hitList.begin();<br>
><br>
> result = hit->getWorldIntersectPoint();<br>
> normal = hit->getWorldIntersectNormal()<wbr>;<br>
> valid = true;<br>
><br>
> return result;<br>
> }<br>
> #endif<br>
>     }<br>
> valid = false;<br>
><br>
>     return result;<br>
> }<br>
><br>
> --<br>
> trajce nikolov nick<br>
><br>
</div></div>> ______________________________<wbr>_________________<br>
> osg-users mailing list<br>
> <a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.<wbr>openscenegraph.org</a><br>
> <a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.<wbr>org/listinfo.cgi/osg-users-<wbr>openscenegraph.org</a><br>
><br>
______________________________<wbr>_________________<br>
osg-users mailing list<br>
<a href="mailto:osg-users@lists.openscenegraph.org">osg-users@lists.<wbr>openscenegraph.org</a><br>
<a href="http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org" rel="noreferrer" target="_blank">http://lists.openscenegraph.<wbr>org/listinfo.cgi/osg-users-<wbr>openscenegraph.org</a><br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">trajce nikolov nick<br></div>
</div>