Guest:
Register
|
Login
|
Member List
|
Search
|
Statistics
|
FAQ
Language
----------
Simplifed Chinese
Traditional Chinese
English
CnPack Forum
»
CnVCL 组件包
» CnGraphics.pas 含有内存泄露
‹‹ Last Thread
|
Next Thread ››
Poll
Trade
Reward
Activity
Printable Version
|
Email to Friend
|
Subscription
|
Favorites
Subject: CnGraphics.pas 含有内存泄露
freespace8
新警察
UID 22007
Digest Posts 0
Credits 26
Posts 11
点点分 26
Reading Access 10
Registered 2007-8-2
Status Offline
#1
Post at 2007-8-2 22:41
Profile
|
Blog
|
P.M.
CnGraphics.pas 含有内存泄露
行 2685-2686
原代码
[Copy to clipboard]
CODE:
if Assigned(FCanvas) then
TCnCanvas(FCanvas).FreeContext; // 释放DC
改为
[Copy to clipboard]
CODE:
if Assigned(FCanvas) then
TCnCanvas(FCanvas).Free; // 释放DC
即可解决。
fastmm报的代码
21 - 28 bytes: TBrush x 3, TPen x 3
29 - 36 bytes: TFont x 3, Unknown x 2
53 - 68 bytes: Unknown x 1
85 - 100 bytes: TCnCanvas x 3
zjy
管理员
UID 2
Digest Posts
6
Credits 2385
Posts 1543
点点分 2385
Reading Access 102
Registered 2002-12-16
Location China
Status Offline
#2
Post at 2007-8-6 08:33
Profile
|
Site
|
Blog
|
P.M.
多谢报告!
经检查,TCnBitmap确实存在内存泄漏,FCanvas在TCnBitmap中创建了而没有释放。
这个单元是2002年在Win98下写的,当时设计时考虑到Win98下GDI资源有限的情况,所以增加了很多GDI句柄动态处理的代码,现在来看在XP下是没什么意义了。
TCnCanvas.FreeContext用于释放图形句柄资源,FCanvas对象本身在TCnBitmap的析构器中释放更为合理。近期我会将修改过的代码提交到CVS上。
Zhou JingYu
CnPack Administrator
http://www.cnpack.org/
Poll
Trade
Reward
Activity
CnPack Forum
CnPack English Forum
> CnWizards IDE Wizards
> CVSTracNT
> Announcements & Others
All times are GMT++8, the time now is 2024-11-22 12:55
Powered by
Discuz!
5.0.0
© 2001-2006
Comsenz Inc.
Processed in 0.008553 second(s), 9 queries , Gzip enabled
TOP
Clear Cookies
-
Contact Us
-
CnPack Website
-
Archiver
-
WAP
Member's CP Home
Edit Profile
Credits Transaction
Public User Groups
Buddy List
Main
Page Views
User Agents
Posts History
Top Forums
Top Threads
Post Ranking
Credit Ranking
Online Time
Team
Moderation Stats