I have an application written in Delphi 7, running in about 100 different places, and only in one of them it keeps sporadically raising an EOutOfResources
exception:
not enough storage available to process this command
on all machines when loading some forms with a TImage
component.
Trying to hunt down the problem, I already checked for GDI leaks using the following tools:
- GDI View from Nirsoft
- GDI Objects column from Windows' Task Manager
- Number of identifiers metric on Windows' Performance Monitor (
Perfmon.msc
)
It appears that the application is not leaking GDI handles. The maximum number of GDI handles reported in the tools above was 680.
I don't think the application is leaking memory, the memory usage stays around 100 to 170 MB.
I also checked a known issue with Delphi leaking entries in the Windows Atom Table, but every time the exception is raised, the Atom Table has very few records, ranging from 170 to 500.
Hunting down where the exception is being thrown, as far as I could track, it appears to be in the Graphics.pas
unit in TBitMap.CopyImage()
, line 5343:
NewHandle := CopyBitmap(AHandle, APalette, NewPalette, DIB, FCanvas);
CopyBitmap()
is called inside TBitmap.CopyImage()
, and I think the exception is thrown in the following code, line 5116:
Result := GDICheck(CreateDIBSection(ScreenDC, BI^, DIB_RGB_COLORS, BitsMem, 0, 0));
At least this is what Eurekalog is telling me:
Since this problem is occurring for this particular client, and is not very frequent, I suspected the antivirus program (Panda Dome) - so I placed the EXE in its exceptions list to see if that could be the problem, but no response from the user yet.
Does anyone have some advice to help me solve this issue?