zoukankan      html  css  js  c++  java
  • GDI对象泄漏检查的一点经验

      程序出现GDI泄漏,在GDIndicator中,Total字段的两个值不一致的情况,前面比后面大了很多,一直没有找到为何,以为是没释放就会导致不一致;
    查看了程序代码,一直无法找到泄漏的地方,于是找各种工具来查看究竟那里泄漏,直到使用 GDIView 的说明里面:

      'GDI Total' and 'All GDI' columns
    The 'GDI Total' column (a new column added on v1.05) displays the total number of all GDI handles found in the GDI table for the specified process. This means that 'GDI Total' column display the sum of the following columns: Pen, ExtPen, Brush, Bitmap, Font, Palette, Region, DC, Metafile DC, Enhanced Metafile DC, and Other GDI.
      The 'All GDI' value is taken from Windows API call (GetGuiResources), and it usually contains a value larger than 'GDI Total', probably because it also counts some internal kernel GDI objects that are not included in the GDI objects table of the process.
    Notice: If you have a problem that the 'All GDI' value is increased, while there is no leak with the other GDI values, it means that you probably have a leak in the creation of icons or cursors (Icons and cursors are created without destroying them later).

      于是查找HICON,HCURSOR的地方,发现有个释放HICON的函数,使用的是 DeleteObject ,而不是 DestroyIcon,修改之后,GDI泄漏有所缓解。

  • 相关阅读:
    ARM IIC接口
    ARM硬件问题转载
    自动排版
    书签
    ARM硬件问题转载
    ATPCS规则1
    开发硬件所需的知识
    今天很崩溃呀
    回顾一下
    ARM汇编条件码
  • 原文地址:https://www.cnblogs.com/coldforce/p/5788179.html
Copyright © 2011-2022 走看看