几何尺寸与公差论坛------致力于产品几何量公差标准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)
-   -   【转帖】does this file cause a leak (http://www.dimcax.com/hust/showthread.php?t=15773)

yang686526 2009-05-04 08:02 PM

【转帖】does this file cause a leak
 
does this file cause a leak?
does this file cause a leak?
hi
i'm getting an mfc memory leak dump when i use a particular dxf file with our application. i've reproduced the problem by wrapping odreadex in an mfc stub. to test, unzip the archive into dd_nonlibs\examples of dwgdirect 2.04.01 and run in debug mode.
i've also included a file that doesn't cause a memory leak dump. change the project command arguments from leak.dxf to noleak.dxf to confirm.
thanks
peter.
attached files
thank you for the project to reproduce the situation.
the leak is caused by odreadex dumping code for polyface mesh. the fix is (exprotocolextension.cpp):
code:
/************************************************************************/
/* polyfacemesh dumper */
/************************************************************************/
class oddbpolyfacemesh_dumper : public oddbentity_dumper
{
public:
void dump(oddbentity* pent, int indent) const
{
....
for (; !piter->done(); piter->step())
{
// oddbpolyfacemeshvertexptr pvertex = piter->entity()->queryx(oddbpolyfacemeshvertex::desc());
oddbpolyfacemeshvertexptr pvertex = oddbpolyfacemeshvertex::cast(piter->entity());
if (!pvertex.isnull())
{
....
}
else
{
// oddbfacerecordptr pface = piter->entity()->queryx(oddbfacerecord::desc());
oddbfacerecordptr pface = oddbfacerecord::cast(piter->entity());
if (!pface.isnull())
{
......
sergey slezkin
great, that solves the leak it our application too. thanks for your fast response.
peter.


所有的时间均为北京时间。 现在的时间是 12:12 AM.