Re: [osg-users] LineSegmentIntersector LEAK-Problem ?
Yes you are right. Code compiles fine in release-mode. Greetings Hagen ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
[osg-users] LineSegmentIntersector LEAK-Problem?
Hello everyone, I using the following code: Is it a bug? Its used inside C++/CLI Environment but inside a pure native class. This was halfways copypasted from one of the examples. It's a function inside a GUIEventHandler called in cas of a GUIEvenetAdapter::REALESE: void pick(const osgGA::GUIEventAdapter ea, osgViewer::Viewer* viewer) { osgUtil::LineSegmentIntersector::Intersection intersection; osg::Node* scene = viewer-getSceneData(); if (!scene) return; /*osg::Node* node = 0; osg::Group* parent = 0;*/ osg::ref_ptrosgUtil::LineSegmentIntersector picker; picker = new osgUtil::LineSegmentIntersector( osgUtil::Intersector::PROJECTION, ea.getXnormalized(),ea.getYnormalized() ); picker-setThreadSafeReferenceCounting(true); ---Thought this could solve the problem but didnt change anything picker-setThreadSafeRefUnref(true); Same here osgUtil::IntersectionVisitor iv(picker.get()); viewer-getCamera()-accept(iv); if (picker-containsIntersections()) { intersection = picker-getFirstIntersection(); ---THIS LINE THROWS AN ERROR } return; } I get the following error: The output window may have more diagnostic information. HEAP[interfaceD.exe]: Invalid Address specified to RtlFreeHeap( 0217, 11395350 ) Windows has triggered a breakpoint in interfaceD.exe. This may be due to a corruption of the heap, which indicates a bug in interfaceD.exe or any of the DLLs it has loaded. This may also be due to the user pressing F12 while interfaceD.exe has focus. The output window may have more diagnostic information. The program '[840] interfaceD.exe: Managed' has exited with code 0 (0x0). The program '[840] interfaceD.exe: Native' has exited with code 0 (0x0). ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] LineSegmentIntersector LEAK-Problem?
HI Hagen, I think there is a good chance that this is false reading or perhaps a bug in your setup/environment. FYI, the intersection visitor isn't multi-threaded so there will be no need to enforce thread safe ref/unref. Robert. On Tue, Jul 22, 2008 at 9:38 AM, Kaiser, Hagen (CT) [EMAIL PROTECTED] wrote: Hello everyone, I using the following code: Is it a bug? Its used inside C++/CLI Environment but inside a pure native class. This was halfways copypasted from one of the examples. It's a function inside a GUIEventHandler called in cas of a GUIEvenetAdapter::REALESE: void pick(const osgGA::GUIEventAdapter ea, osgViewer::Viewer* viewer) { osgUtil::LineSegmentIntersector::Intersection intersection; osg::Node* scene = viewer-getSceneData(); if (!scene) return; /*osg::Node* node = 0; osg::Group* parent = 0;*/ osg::ref_ptrosgUtil::LineSegmentIntersector picker; picker = new osgUtil::LineSegmentIntersector( osgUtil::Intersector::PROJECTION, ea.getXnormalized(),ea.getYnormalized() ); picker-setThreadSafeReferenceCounting(true); ---Thought this could solve the problem but didnt change anything picker-setThreadSafeRefUnref(true); Same here osgUtil::IntersectionVisitor iv(picker.get()); viewer-getCamera()-accept(iv); if (picker-containsIntersections()) { intersection = picker-getFirstIntersection(); ---THIS LINE THROWS AN ERROR } return; } I get the following error: The output window may have more diagnostic information. HEAP[interfaceD.exe]: Invalid Address specified to RtlFreeHeap( 0217, 11395350 ) Windows has triggered a breakpoint in interfaceD.exe. This may be due to a corruption of the heap, which indicates a bug in interfaceD.exe or any of the DLLs it has loaded. This may also be due to the user pressing F12 while interfaceD.exe has focus. The output window may have more diagnostic information. The program '[840] interfaceD.exe: Managed' has exited with code 0 (0x0). The program '[840] interfaceD.exe: Native' has exited with code 0 (0x0). ___ 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
[osg-users] LineSegmentIntersector LEAK-Problem?
I traced the error now: The function LineSegementIntersector::getFirstIntersection() executes very well to the last bit that is: Dereference _intersections.begin(); It jumps therefor to xtree.h : reference operator*() const { // return designated value return ((reference)**(const_iterator *)this); --TO HERE } Afterwards it jumps for a reason that i dont understand to vector destructor and there to: void _Tidy() { // free all storage if (_Myfirst != 0) { // something to free, destroy and deallocate it #if _HAS_ITERATOR_DEBUGGING this-_Orphan_all(); #endif /* _HAS_ITERATOR_DEBUGGING */ _Destroy(_Myfirst, _Mylast); this-_Alval.deallocate(_Myfirst, _Myend - _Myfirst); --THIS IS THE POINT WHERE THE PROGRAM DIES } _Myfirst = 0, _Mylast = 0, _Myend = 0; } So it tries somehow to free items in a vector that doesnt exist (?) A solution for my pov is: Instead of writing (picker is a LineSegementIntersector: Picker-getFirstIntersection()-dowhatwever() I write: Picker-getIntersections().begin()-dowhatever(); Still think there must be a bug somewhere at microsoft stl degubimpl or openscenegraph. Greetings, Hagen ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] LineSegmentIntersector LEAK-Problem?
Hi Hagen, I believe the OSG code is OK, a quick code review just now doesn't reveal anything that might be amiss. I have been told of bug with certain combinations of VS's iterator debugging. I'm not a Windows developers so the exact details went over my head, but my guess is that this might be worth looking in to. It'd also be worth just compiling your app in release and seeing if there are any problems. Robert. On Tue, Jul 22, 2008 at 3:14 PM, Kaiser, Hagen (CT) [EMAIL PROTECTED] wrote: I traced the error now: The function LineSegementIntersector::getFirstIntersection() executes very well to the last bit that is: Dereference _intersections.begin(); It jumps therefor to xtree.h : reference operator*() const { // return designated value return ((reference)**(const_iterator *)this); --TO HERE } Afterwards it jumps for a reason that i dont understand to vector destructor and there to: void _Tidy() { // free all storage if (_Myfirst != 0) { // something to free, destroy and deallocate it #if _HAS_ITERATOR_DEBUGGING this-_Orphan_all(); #endif /* _HAS_ITERATOR_DEBUGGING */ _Destroy(_Myfirst, _Mylast); this-_Alval.deallocate(_Myfirst, _Myend - _Myfirst); --THIS IS THE POINT WHERE THE PROGRAM DIES } _Myfirst = 0, _Mylast = 0, _Myend = 0; } So it tries somehow to free items in a vector that doesnt exist (?) A solution for my pov is: Instead of writing (picker is a LineSegementIntersector: Picker-getFirstIntersection()-dowhatwever() I write: Picker-getIntersections().begin()-dowhatever(); Still think there must be a bug somewhere at microsoft stl degubimpl or openscenegraph. Greetings, Hagen ___ 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