查看单个帖子
旧 2009-05-06, 05:36 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】memory leak in odamfcappdll

memory leak in odamfcappdll
memory leak in odamfcappdll
i use visualc++ v6.0 to copile the adamfcappdll.
i run the application then i close the application without do nothing.
i get this beautiful message
detected memory leaks!
dumping objects ->
{48} normal block at 0x01b34318, 33 bytes long.
data: < c > 00 43 00 cd cd cd cd cd cd cd cd cd cd cd cd cd
{47} normal block at 0x01b32c88, 40 bytes long.
data: < |l > 14 7c 4c 10 16 00 00 00 00 00 00 00 00 00 00 00
object dump complete.
the same thing happen when i run my simple application that use the .dll library.
help please.
tia.
sorry ,
i've forget to tell that i use the dwgdirect 1.13.
these 2 blocks of memory reported as leaks are freed in static objects destructors after the heap is scanned for leaked memory.
sergey slezkin
memory leaks
i have the same problem:
etected memory leaks!
dumping objects ->
{74134} normal block at 0x08415fe0, 12 bytes long.
data: <4=s )c > 34 3d 53 01 00 00 00 00 a4 29 43 08
{74133} normal block at 0x08432998, 36 bytes long.
data: < stat> 01 00 00 00 17 00 00 00 17 00 00 00 53 74 61 74
{47748} normal block at 0x084b6fe0, 12 bytes long.
data: <4=s > 34 3d 53 01 00 00 00 00 94 ff 07 03
{47747} normal block at 0x0307ff88, 36 bytes long.
data: < stat> 01 00 00 00 17 00 00 00 17 00 00 00 53 74 61 74
sorry! i have the problem in my application. but i hope the same is. i think the dwgdirect functionaly is wonderfull. how can i resolve my memory leek problem?
opendwg version: 1.13.02
zoltan
last edited by wscad; 18th october 2005 at 04:10 amfff">.

thank you very much for your answer.
my problem is this. my leaked memory place vary from run to run. how can i find the right place?
your example was verry exciting and useful with static memory leaks.
have you any idea?
zoltan
hi! thanks a lot for your tip.
with your instruction i have found the function wich cause memory leaks.
prec->zoomextents(); after oddbviewporttablerecordptr prec...
show this code:
if (pdb->gettilemode())//if (actspace == acmodelspace)
{
oddbviewporttableptr pvptbl = pdb->getviewporttableid().safeopenobject();
oddbobjectid id = pvptbl->getactiveviewportid();
if (id)
{
oddbviewporttablerecordptr prec = id.safeopenobject (oddb::kforwrite);
prec->zoomextents();
}
}
else
{
oddbblocktablerecordptr pblcltblrec = pdb->getactivelayoutbtrid().safeopenobject();
oddblayoutptr playout = pblcltblrec->getlayoutid().safeopenobject();
oddbobjectid actid = playout->activeviewportid();
if (actid)
{
oddbviewportptr pvp = actid.safeopenobject(oddb::kforwrite);
pvp->zoomextents();
}
}
quote:
originally posted by sergey slezkin
if number of leaked memory allocation varies from run to run try the following:
set a break point in your programm (for example before readfile()). after reaching this break point set break point at memory allocation and remember the allocation number (n). remove break point, perform actions required in your application and exit. look at leaked block allocation number and remember it (l).
repeat the steps above. be sure that (l-n) is constant value from run to run. if so - you can calculate the required number for the next run having seen new n value.
if (l-n) is not constant - try to set breakpoint in other place closer to expected leaked block allocation.
how do you set a break point at the memory allocation?? i am looking at crtdbg.h and i can't put a break-point any where.
thanks
actually i need not zoomextent function. whitout this i have not memory leaks.
last edited by wscad; 25th october 2005 at 11:07 pmfff">.
wscad
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)