GDI句柄在DotNET应用程序中 [英] GDI handles in a DotNET application

查看:202
本文介绍了GDI句柄在DotNET应用程序中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的纯DotNET库在非托管桌面应用程序中作为插件运行。我已经得到一个稳定(虽然低)的崩溃报告流,似乎表明GDI句柄(错误消息中的字体等)恢复到系统字体的问题,显示所有种类的控件分解,大规模崩溃后不久)。

My pure DotNET library runs as a plugin inside an unmanaged desktop application. I've been getting a steady (though low) stream of crash reports that seem to indicate a problem with GDI handles (fonts in error messages etc. revert to the system font, display of all sorts of controls break down, massive crash shortly after).

我的表单有几个控件,但我在用户控件中做了很多GDI +绘图。

My Forms have few controls, but I do a lot of GDI+ drawing in User controls. What's a good way to tell how many handles I'm using, or even leaking?

感谢,
David

Thanks, David

推荐答案

我不得不处理过去的同类问题。为了检查您的应用程序分配了多少GDI对象,您可以使用一个免费工具 GDIUsage

I've had to deal with the same kind of problem in the past. In order to inspect how many GDI objects your application is allocating you can use a free tool called GDIUsage.

在我的情况下,应用程序崩溃,因为它分配的 10.000 GDI对象限制在Windows XP。

In my case the application was crashing because it was allocating more than 10.000 GDI objects, which is a hard limit in Windows XP. It might be worth looking into it.

我已在这里介绍这个问题:

http://megakemp.com/2009/02/25/gdi-memory-leak-in -windows-forms /

I've blogged about this problem here:
http://megakemp.com/2009/02/25/gdi-memory-leak-in-windows-forms/

这篇关于GDI句柄在DotNET应用程序中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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