<DIV>Thanks , Robert ,i will follow what you said :)</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV></DIV><BR><PRE>在2008-07-23 17:00:31,"Robert Osfield" <robert.osfield@gmail.com> 写道:
>Hi Heishujing,
>
>If you think you have a bug fix could you please post the whole
>modified file to osg-submissions.  You can subscribe to the list via:
>
>   http://www.openscenegraph.org/projects/osg/wiki/MailingLists
>
>Also have a read through the notes on SubmissionsProtocol so you know
>the best way to submit changes for review/merging.
>
>  http://www.openscenegraph.org/projects/osg/wiki/MailingLists/SubmissionsProtocol
>
>Also when posting could you provide your full name, as I credit all
>contributors in the svn commit messages (this is what the AUTHORS.txt)
>comes from.
>
>
>Thanks,
>Robert.
>
>On Wed, Jul 23, 2008 at 2:17 AM, heishuijing_2000
><HEISHUIJING_2000 wrote:="" hi="" Some="" days="" later="" have="" sent="" a="" email="" which="" is="" about="" this="" subject="" Gordon="" Tomlinson="" answered="" as="" this:="" is="" a="" compiler="" problem="" not="" an="" OSG="" problem="" so="" you="" really="" need="" to="" ask="" it="" a="" problem="" with="" their="" compiler="" and="" code="" not="" OSG="" this="" is="" my="" email="" before:="" am="" sorry="" to="" ask="" about="" this="" topic="" again="" I="" have="" asked="" the="" same="" before.="" That="" about="" osgMFC="" example.="" Somebody="" in="" this="" email="" List="" help="" me="" with="" it.="" And="" that="" perfect.="" is="" a="" known="" issue="" BUG="" with="" MFC="" were="" MFC="" makes="" a="" call="" to="" in="" the="" destructor="" of="" the="" _AFX_DEBUG_STATE="" followed="" by="" _CrtSetDbgFlag="" which="" sets="" it="" to="" memory="" leak="" test="" at="" program="" exit="" This="" destructor="" is="" called="" at="" exit="" atexit="" but="" before="" statics="" residing="" in="" dlls="" and="" are="" destroyed="" resulting="" in="" many="" false="" memory="" leaks="" are="" reported="" I="" use="" VS2003="" and="" osg2.4="" in="" debug="" mode.="" In="" my="" project="" i="" Just="" add="" mfc71d.lib="" before="" all="" of="" the="" osg="" Libs="" the="" VS="" no="" longer="" report="" memory.="" Unfortunately="" the="" project="" report="" memory="" leak="" again.="" That="" is="" about="" osgUtil::Tessellator="" is="" my="" test="" code:="" the="" test="" code="" is="" drawing="" a="" concave="" like="" a="" rect="" containing="" a="" triangle="" with="" it="" Rect="" and="" the="" triangle="" intersect="" with="" one="" point="" we="" can="" see="" bellow="" an="" concave="" polygon="" osgViewer::Viewer="" viewer="" osg::ref_ptr="" osg::Vec3Array="" vertices="new" osg::Vec3Array="" vertices-="" vertices-="" vertices-="" vertices-="" vertices-="" vertices-="" vertices-="" vertices-="" osg::ref_ptr="" osg::Vec3Array="" pNormal="new" osg::Vec3Array="" pNormal-="" osg::ref_ptr=""><osg::Geometry> geom = new osg::Geometry;
>>      >>> geom->setVertexArray(vertices.get());
>>      >>> geom->setNormalArray(pNormal.get());
>>      >>> geom->setNormalBinding(osg::Geometry::BIND_OVERALL);
>>      >>> geom->addPrimitiveSet(new
>>      >>> osg::DrawArrays(osg::PrimitiveSet::POLYGON,0,vertices->size()));
>>      >>> osg::ref_ptr< osgUtil::Tessellator > tes = new
>> osgUtil::Tessellator();
>>      >>> tes->setTessellationType(osgUtil::Tessellator::TESS_TYPE_GEOMETRY);
>>      >>> tes->setBoundaryOnly(false);
>>      >>> tes->setWindingType( osgUtil::Tessellator::TESS_WINDING_ODD);
>>      >>> tes->retessellatePolygons(*geom);
>>
>>      >>> osg::ref_ptr<osg::Geode> geode = new osg::Geode;
>>      >>> geode->addDrawable(geom.get());
>>      >>> osg::ref_ptr<osg::Group> pGroup = new osg::Group;
>>      >>> pGroup->addChild(geode.get());
>>      >>> viewer.setSceneData( pGroup.get() );
>>
>>      >>> I test this code in non-MFC project such as console project,that
>> works
>>      >>> perfect.No memory leak is reported. But when i turn to osg  MFC
>> project,the
>>      >>> VS always reports memory leak . I notice that if the polygon is
>>      >>> self-intersect ,there must be memory leak report in MFC project.
>>
>>      >>> I really do not know how to do about it . I just want to find a
>> method to
>>      >>> prevent the VS reprot false memory leak. Anyone help me? Thank you
>> ,:)
>>
>>      Recently i trace this memory leak In VS with osg2.4 osgviewerMFC
>> project, i do find the problem.I modify the osg code:
>>          void Tessellator::reset()
>>          {
>>              if (_tobj)
>>              {
>>                  gluDeleteTess(_tobj);
>>                  _tobj = 0;
>>              }
>>              for (Vec3dList::iterator i = _coordData.begin(); i !=
>> _coordData.end(); ++i) {
>>                  delete (*i);
>>              }
>>              _coordData.clear();
>>              _newVertexList.clear();
>>              _primList.clear();
>>              _errorCode = 0;
>>          }
>>          as below:
>>
>>          void Tessellator::reset()
>>          {
>>              if (_tobj)
>>              {
>>                   gluDeleteTess(_tobj);
>>                   _tobj = 0;
>>              }
>>              for (Vec3dList::iterator i = _coordData.begin(); i !=
>> _coordData.end(); ++i) {
>>                   delete (*i);
>>              }
>>              osg::Vec3* vertex = NULL;
>>              for (NewVertexList::iterator j = _newVertexList.begin(); j !=
>> _newVertexList.end(); ++j) {
>>                    NewVertex& newVertex = (*j);
>>                    vertex = newVertex._vpos;
>>                    delete vertex;
>>                    newVertex._vpos = NULL;
>>              }
>>              vertex = NULL;
>>              _coordData.clear();
>>              _newVertexList.clear();
>>              _primList.clear();
>>              _errorCode = 0;
>>           }
>>
>>           Then the memory leak report disappears,and this does perfect. As
>> glu does, osgUtil::Tessalator can draw composite polygon containing concave
>> polygon and self-intersecting polygon.
>>
>>
>>
>> ________________________________
>> 卡卡上网安全助手6.0,震撼上市,绝杀木马!
>> _______________________________________________
>> 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::Group></osg::Geode></osg::Geometry></HEISHUIJING_2000></PRE><br><!-- footer --><br> 
<hr>
<font style="font-size:12px;line-height:15px;">卡卡上网安全助手6.0,</font><a style="font-size:12px;line-height:15px; color:blue; text-decoration:underline;" href="http://popme.163.com/link/4634_0722_8883.html">震撼上市,绝杀木马!</a>