GDI处理在DOTNET应用 [英] GDI handles in a DotNET application

查看:339
本文介绍了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?

谢谢, 大卫

推荐答案

我不得不处理在过去同样的问题。为了检查许多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内存泄漏功能于Windows的形式/

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

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

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