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


返回   几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 » 仿射空间:CAX软件开发(三)二次开发与程序设计 » CAD二次开发 » AutoCAD二次开发 » DirectDWG
用户名
密码
注册 帮助 会员 日历 银行 搜索 今日新帖 标记论坛为已读


 
 
主题工具 搜索本主题 显示模式
旧 2009-05-07, 03:31 PM   #1
yang686526
高级会员
 
注册日期: 06-11
帖子: 14579
精华: 1
现金: 224494 标准币
资产: 234494 标准币
yang686526 向着好的方向发展
默认 【转帖】select And Gdi Memory Leaks

select and gdi memory leaks
select and gdi memory leaks
i try to add a select fct in my view class (like cdwgviewer::select in odamfcapp)
it's work fine but i have a gdi memory leaks when i call select ... i forget to do something? can you help me?
thank you and happy new year
thierry
/////////////////////////////////////////////////////////////////////////////
void cmyview:nlbuttonup(uint nflags, cpoint point)
{
releasecapture();
odgsview* pview = getactiveview();
switch(m_interactionmode)
{
case kselectpoint:
{
crect l_rc;
l_rc.left = point.x ;
l_rc.right = point.x +6;
l_rc.top = point.y ;
l_rc.bottom= point.y +6;
select( &l_rc);
myssetdrawable* pmysset = ssetdrawable();
if(pmysset)
{
redrawwindow();
....
....
}
}
break;
}
cview:nlbuttonup(nflags, point);
}
///////////////////////////////////////////////////////////////////////////////////
void cmyview::select(const crect& p_rc)
{
oddblayoutptr playout = m_layoutid.safeopenobject();
oddbobjectid spaceid = playout->getblocktablerecordid();
if(m_pssetdrawable.isnull())
{
m_pssetdrawable = myssetdrawable::createobject();
}
myssetdrawable* pss = static_cast<myssetdrawable*>(m_pssetdrawable.get() );
odgsview* l_pview = getactiveview();
//// class selectionreactor ////////////////////////
class selectionreactor : public odgsselectionreactor
{
oddbobjectid m_layoutid;
oddbobjectid m_spaceid;
oddbobjectidarray* m_psset;
public:
selectionreactor(oddbobjectidarray& sset, const oddbobjectid& spaceid, const oddbobjectid& layoutid)
: m_psset(&sset)
, m_spaceid(spaceid)
, m_layoutid(layoutid)
{
m_psset->clear();
}
// notifications
bool selected(const odgidrawabledesc& drawabledesc)
{
const odgidrawabledesc* pdesc = &drawabledesc;
while(pdesc->pparent && pdesc->pparent->persistid != m_spaceid)
{
// mark drawable to be skipped
// (as we don't want to get more 'selected' notifications from its children)
pdesc->marktoskip(true);
pdesc = pdesc->pparent;
}
if(pdesc && pdesc->persistid)
{
pdesc->marktoskip(true); // regen abort for selected drawable
oddbobjectid id(pdesc->persistid);
oda_trace2("[%s]:<%s>\n",
id.gethandle().ascii().c_str(),
oddbobjectptr(id.safeopenobject())->isa()->name()
);
if(id!=m_layoutid)
{
m_psset->append(id);
}
}
return true;
}
}
l_selectionreactor(pss->m_sset, spaceid, m_layoutid);
/////////////////////////////////////////////////////
if(p_rc.top == p_rc.bottom && p_rc.left == p_rc.right)
{
// todo: implement point select
}
else
{
hcursor oldcur = ::getcursor();
::setcursor(::loadcursor(null, idc_wait));
l_pview->select((odgsdcpoint*)&p_rc, 2, &l_selectionreactor);
::setcursor(oldcur);
}
if(ssetdrawable())
{
//ondrag();
drawselection(false); // highlight
}
}
last edited by thierry; 5th january 2005 at 03:23 amfff">.
its a bugg ....?
i think it's a bugg ....
its only with wingdi device, the problem it's the same with odamfcapp
(some pen an brush not delete after select)
and after some select on a big dwg (500 ko) the gdi crash
have you a solution ?

is it possible to reproduce this problem in odamfcapp?
(i can't reproduce any crashes on files that is much bigger then 500kb)
sincerely yours,
george udov
buggs
is it possible to reproduce this problem in odamfcapp?
(i can't reproduce any crashes on files that is much bigger then 500kb)
yes, after many selection in this drawing, the gdi crash, and if you watch with a tool like gdileaks (from microsoft) you can see that not all the pen and brush are destroy....
thierry

thierry, it seems that you forget to attach a drawing
sincerely yours,
george udov
memory leaks
oh sorry,
i have the probleme with this file, but the memory leaks with some other ...
thierry
attached files (403.3 kb, 7 views)


thierry, could you please look, if you will still have problem with the version of exgigdigeometry.cpp, that you can find in folder george, server ftp.softdev.spb.ru (i'll send you login and password via private message).
sincerely yours,
george udov
exgigdigeometry.cpp
quote:
originally posted by george udov
thierry, could you please look, if you will still have problem with the version of exgigdigeometry.cpp, that you can find in folder george, server ftp.softdev.spb.ru (i'll send you login and password via private message).
i have a compile error ... 'odtruncatetolong' does not existe
---------------------------------------------
exgigdigeometry.cpp
d:\projet\communs\dwgdirect\dd_nonlibs\examples\ex render\win\exgigdigeometry.cpp(54) : error c2065: 'odtruncatetolong' : undeclared identifier
---------------------------------------------
regards
thierry

sorry - my error. please check out odround.h from same location to your dwgdirect's include folder.
sincerely yours,
george udov
thank you george, i have try your files. but the problem is the same. first i have recompiled the library, i have add some line to be sure to use the good file like that :
file* m_logfile;
m_logfile = fopen("c:\\testod.log","a");
fprintf(m_logfile, " wingdimodule createdeviceobject : \n");
fclose(m_logfile);
....
i run odamfcapp.exe with "gdiusage.exe ---gdi usage for windows xp/2000/nt 4.0" to watch the gdi memory with a little standard dwg
the gdi memory stat is:
first before select
bitmap 14
brush 5
dc 2
pen 0
second select
bitmap 14
brush 7
dc 2
pen 2
third select
bitmap 14
brush 9
dc 2
pen 6
and if i try with a more big dwg ... with a large select ...
first before select
bitmap 14
brush 5
dc 2
pen 0
second select
bitmap 14
brush 1252
dc 582
pen 2
third select
bitmap 14
brush 2505
dc 2
pen 1165
and after a few select gdi crash
my log file is
-------------------------------------------------------
wingdimodule initapp :
wingdimodule createdeviceobject :
exgigdigeometry :
exgswin32device :
exgsgdivectorizedevice :
wingdimodule createdeviceobject :
exgigdigeometry :
exgswin32device :
exgsgdivectorizedevice :
wingdimodule createviewobject :
wingdimodule createviewobject :
wingdimodule createviewobject :
wingdimodule initapp :
wingdimodule createdeviceobject :
exgigdigeometry :
exgswin32device :
exgsgdivectorizedevice :
wingdimodule createdeviceobject :
exgigdigeometry :
exgswin32device :
exgsgdivectorizedevice :
wingdimodule createviewobject :
wingdimodule createviewobject :
wingdimodule createviewobject :
-------------------------------------------------------
i hope this sample can help you
best regards
thierry
select function and gdi leak : i confirm
hi,
i have the same problem with select function :
crash after several selects
laurent
thanks,
laurent
good with opengl
thank you,
the pb is just with wingdi device, it's work fine with opengl and opengl-cache
thierry
wingdi leak
ok,
this bug will fix in the next release ?
laurent
thanks,
laurent
buggs
have you found a solution ? this buggs will correct in the next release?
yang686526离线中   回复时引用此帖
GDT自动化论坛(仅游客可见)
 


主题工具 搜索本主题
搜索本主题:

高级搜索
显示模式

发帖规则
不可以发表新主题
不可以回复主题
不可以上传附件
不可以编辑您的帖子

vB 代码开启
[IMG]代码开启
HTML代码关闭

相似的主题
主题 主题发起者 论坛 回复 最后发表
【转帖】has gdi leak yang686526 DirectDWG 0 2009-05-05 11:46 AM
【转帖】gdi resource leak 9workaround0 yang686526 DirectDWG 0 2009-05-05 11:10 AM
【转帖】gdi leak with ttf-fonts yang686526 DirectDWG 0 2009-05-05 11:10 AM
游戏进阶之千里之行始于足下(一)gdi 汇编 huangyhg vc编程 0 2007-11-12 01:28 PM


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


于2004年创办,几何尺寸与公差论坛"致力于产品几何量公差标准GD&T | GPS研究/CAD设计/CAM加工/CMM测量"。免责声明:论坛严禁发布色情反动言论及有关违反国家法律法规内容!情节严重者提供其IP,并配合相关部门进行严厉查处,若內容有涉及侵权,请立即联系我们QQ:44671734。注:此论坛须管理员验证方可发帖。
沪ICP备06057009号-2
更多