当我删除CBrush时,GDI对象计数不会减少 [英] GDI object count does not decrements when i delete the CBrush

查看:59
本文介绍了当我删除CBrush时,GDI对象计数不会减少的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在创建和删除MFC gdi对象,并通过Windows任务管理器观察应用程序使用的GDI对象的数量。



当我通过CreateSolidBrush创建CBrush对象时,我观察到应用程序的GDI对象计数的增量。然而,当我通过DeleteObject删除画笔时,没有发生任何变化。



当我删除我创建的画笔时,是否有人知道为什么GDI对象计数不会减少?



提前致谢。

Sanoop Das K

Hi,

I am creating and deleting MFC gdi objects and watching the number of GDI Objects that application uses via Windows Task Manager.

When i create a CBrush object by CreateSolidBrush i observe an increment in GDI Object count of application. However when i delete the brush by DeleteObject there happens no change.

Does anybody have an idea why GDI object count does not decrements when i delete the brush i have created?

Thanks in advance.
Sanoop Das K

推荐答案

目前为止我知道,在调用 DeleteObject()时,并不总是释放实心画笔的内存,但保留并重复使用以下 CreateSolidBrush()只需更换颜色值即可调用。



这可以通过在创建和删除之前和之后调用 GetGuiResources()来验证。在某些情况下,计数会在创建时增加,而在删除时不会减少,如您所指出的。在其他情况下,计数不会在创建时增加,表示重复使用上一个画笔。
As far as I know, the memory of solid brushes is not always freed when calling DeleteObject() but reserved and reused with following CreateSolidBrush() calls by simply replacing the color value.

This can be verified by calling GetGuiResources() before and after creation and deletion. In some cases, the count will increase upon creation and not decrease upon deletion as noted by you. In other cases, the count will not increase upon creation indicating that a previous brush is reused.


这篇关于当我删除CBrush时,GDI对象计数不会减少的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆