开发者

Delphi EOutOfResources (GDIError)

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-12d284开发者_开发问答a7$\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


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜