我编写了一个应用程序,在将 TBitmap32 保存到流时,偶尔会发现 Graphics 单元的 GDIError 方法引发的 EOutofResources 错误。
据我所知,它可能来自 gdi 限制或堆限制。我知道对于该过程,默认限制为 10000 个句柄。所以我的应用程序根据任务管理器报告只有 620。
我已经下载并运行了桌面堆信息监控工具,它报告了这个:
Desktop Heap Information Monitor Tool (Version 8.1.2925.0)
Copyright (c) Microsoft Corporation. All rights reserved.
-------------------------------------------------------------
Session ID: 0 Total Desktop: ( 7360 KB - 11 desktops)
WinStation\Desktop Heap Size(KB) Used Rate(%)
-------------------------------------------------------------
WinSta0\Default 3072 44.5
WinSta0\Disconnect 64 4.5
WinSta0\Winlogon 128 10.2
Service-0x0-3e7$\Default 512 29.1
Service-0x0-3e4$\Default 512 6.8
Service-0x0-3e5$\Default 512 6.8
SAWinSta\SADesktop 512 0.5
__X78B95_89_IW\__A8D9S1_42_ID 512 0.5
Service-0x0-1ae39$\Default 512 2.4
Service-0x0-12d284a7$\Default 512 2.5
Service-0x0-1312b6d4$\Default 512 15.0
-------------------------------------------------------------
如上所述,我只使用了 winsta0 中 44% 的桌面堆。
此外,此错误会不时引发。它从未达到提到的限制。我如何检查问题出在哪里?是什么导致引发此错误?
谢谢