通过com接口调用时,字体对象未释放 [英] Font objects are not getting released while calling through com interface

查看:132
本文介绍了通过com接口调用时,字体对象未释放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


在我的c#应用程序中,Com接口用于从非托管代码调用由托管代码(c#)创建的自定义消息框.长时间运行应用程序后,GDI对象正在增加.字体对象的数量每次都增加.在非托管代码中使用Coinitialize和Couninitialize来初始化com.
谁能说出这种现象的原因?

Hi,
In my c# application,Com interface is used to invoke custom message box created by managed code (c#) from unmanaged code.After running application for long time,GDI objects are getting increased.While analysing by GDI view, it shows like Font objects are not getting released.Font objects number getting increased each time.Coinitialize and Couninitialize were used in unmanaged code for initializing com.
Can anyone tell reason for this behaviour?

推荐答案

您可以手动清理资源.
请参见此处 [
You could clean up your resources manually.
See here[^].


泄漏似乎在您的托管代码中. GDI对象需要明确地释放/销毁,而且人们经常会怀念中间对象.
The leak seems to be in your managed code. GDI objects need to be explicitly released/destroyed, and often people miss doing this for intermediate objects.


这篇关于通过com接口调用时,字体对象未释放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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