几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   DirectDWG (http://www.dimcax.com/hust/forumdisplay.php?f=89)
-   -   【转帖】memory leaks or my error in queryx function (http://www.dimcax.com/hust/showthread.php?t=17179)

yang686526 2009-05-06 05:38 PM

【转帖】memory leaks or my error in queryx function
 
memory leaks or my error in "queryx" function?
memory leaks or my error in "queryx" function?
memory leaks in "queryx" function or my error?
i use odamfcappdll with visual studio 6.
for to see the problem you can modify the funcion oneditacisconversion()
if (!pnewobj.isnull())
{
// test memory lek
if (((oddbentityptr )pnewobj)->iskindof(oddbpolyfacemesh::desc()))
{
oddbpolyfacemeshptr ppoly = ((oddbentityptr )pnewobj);
oddbobjectiteratorptr piter = ppoly->vertexiterator();
for (; !piter->done(); piter->step())
{
oddbpolyfacemeshvertexptr pvertex = piter->entity()->queryx(oddbpolyfacemeshvertex::desc());
}
}
// end test
pent->handoverto(pnewobj);
}
you can read the attach file called "region.dwg". when you exit from application several memory leak appear. it is a my error in use of queryx?
thank's for help.
attached files
how can i obtain vertex and face of polyfacemesh without use queryx?
try next code - in this case no memory leak
// test memory lek
if (((oddbentityptr )pnewobj)->iskindof(oddbpolyfacemesh::desc()))
{
oddbpolyfacemeshptr ppoly = ((oddbentityptr )pnewobj);
oddbobjectiteratorptr piter = ppoly->vertexiterator();
for (; !piter->done(); piter->step())
{
oddbentityptr pentity = piter->entity();
if (pent->iskindof(oddbpolyfacemeshvertex::desc()))
{
oddbpolyfacemeshvertexptr pvertex = piter->entity();
}
if (pent->iskindof(oddbfacerecord::desc()))
{
oddbfacerecordptr precord = piter->entity();
}
if (pent->iskindof(oddbsequenceend::desc()))
{
oddbsequenceendptr psqend = piter->entity();
}
}
}
// end test
great!your code work fine without memory leak. it is only change pent with pentity.
is it a good idea change code in class oddbpolyfacemesh_dumper in example odreadexdll and odreadex?
thanks a lot


所有的时间均为北京时间。 现在的时间是 09:35 PM.