偶然发现wince系统下mfc的一个bug

=============================================================
标题:偶然发现wince系统下mfc的一个bug
摘要:
备注:VC2005 + wince5.0
日期:2010.7.31
姓名:朱铭雷
=============================================================
     今天偶然发现微软wince系统下mfc的一个bug,微软的网站上也有记录,如下:
    BUG: Memory leaks when you use the CWnd class versions of the GetDC method and the ReleaseDC method
    When you run code that calls the CWnd::GetDC function followed by the CWnd::ReleaseDC function, a memory leak of 4 bytes occurs. The cause of this bug is currently unknown. To avoid this problem, do not use the CWnd class versions of the GetDC method and the ReleaseDC method. Use the GetDC function and the ReleaseDC function. Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
    Steps to Reproduce the Behavior
In a method that is a part of a class that is derived from CWnd, insert the following code in your application:

    If you run this code and then check the system memory before and after you run the code, you notice that the system memory leaks four bytes per iteration. If you change the code to the following code, the memory leak does not occur:
 HDC hDC;

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 6
    评论
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值