Delphi EOutOfResources(GDI错误)

发布于 2024-11-08 20:28:12 字数 1429 浏览 2 评论 0原文

我编写了一个应用程序,其中偶尔会出现 EOutofResources 错误 将 TBitmap32 保存到流时,由 Graphics 单元的 GD​​IError 方法引发。

据我所知,它可能来自 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% 的桌面堆。

此外,这个错误时不时会出现。它永远不会达到提到的限制。 我怎样才能检查问题出在哪里?是什么原因导致出现此错误?

谢谢

I have written an application in which I find ocasionally EOutofResources errors
raised by GDIError method of Graphics unit when saving TBitmap32 to a stream.

As far as I know it can come from gdi limits or heap limits.
i know that for the process there is a default limit of 10000 handles.
So my application according to the task manager reports only 620.

I have downloaded and run Desktop Heap Information Monitor Tool which reported this:

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
-------------------------------------------------------------

As above I have used only 44% of the desktop heap in winsta0.

Besides this error is raised from time to time. it never reaches mentioned limits.
How can i check where the problem is? What causes raising this error?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

坚持沉默 2024-11-15 20:28:13

您可能存在资源和/或内存泄漏。

查找内存泄漏
如果您使用 FastMM 的调试版本,它会在程序关闭时向您显示内存泄漏报告。

以下文章应该可以帮助您:
http://wiert.wordpress.com/2009/07/29/delphi-fastmm-using-fastmm4-for-debugging-your-memory-allocations-part-1-introduction/

查找资源泄漏
请注意,FastMM 虽然是查找内存泄漏的重要工具,但它无法发现资源泄漏。
AQTime 可以找到这些,并且有 30 天的试用期。请访问:
http://smartbear.com/products/development-tools/performance-profiling/

如果您想要开源资源泄漏工具,请尝试:http://www.kbasm.com/denomo。 html

好 打猎。

You probably have a resource and/or memory leak.

Finding memory leaks
If you use the debug version of FastMM, it will show you a report of memory leaks when your program closes.

The following article should help you out:
http://wiert.wordpress.com/2009/07/29/delphi-fastmm-using-fastmm4-for-debugging-your-memory-allocations-part-1-introduction/

Finding resource leaks
Note that FastMM, while an essential tool for finding memory leaks does not find resource leaks.
AQTime can find those, and it has a 30 day trail period. Check it out at:
http://smartbear.com/products/development-tools/performance-profiling/

If you want an open source resource leak tool try: http://www.kbasm.com/denomo.html

Good hunting.

狼性发作 2024-11-15 20:28:13

这可能根本不是资源错误。有时,Delphi 会报告无法转换为特定错误消息的 GDI 错误,即资源不足。请参阅 Graphics.pas 中 GDIError 的实现。

如果您可以在 IDE 中重现此问题,那么找出发生这种情况的位置/原因的最佳方法可能是在编译器设置中启用“使用调试 DCU”选项,并在运行应用程序时启用“在 Delphi 异常时停止”调试器选项。

This probably isn't a resource error at all. Sometimes Delphi will report GDI errors that can't be translated into a specific error message as out-of-resources. See the implementation of GDIError in Graphics.pas.

If you can reproduce this in the IDE, the best way to find out where/why it happens is probably to enable the Use Debug DCUs option in the compiler settings and have the Stop On Delphi Exceptions debugger option enabled while running your app.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文