EOutOfMemory - any idea what could be the reason

delphi package - automated exception handling
Post Reply
Han312
Posts: 54
Joined: Mon Mar 14, 2016 3:49 pm

EOutOfMemory - any idea what could be the reason

Post by Han312 »

We get sometimes reports with an EOutOfMemory exception. Rarely - but they are there.
It is 64-Bit-software. But even for 32 bit the system should have enough memory.
We check always for memory leaks, but not every possible combination. The chance to have one is low.
Any idea what could be the reason or what I could do to find it?

Code: Select all

operating system                : Windows 10 x64 build 19043
system language                 : French
system up time                  : 12 days 18 hours
program up time                 : 27 minutes 15 seconds
physical memory                 : 6116/16253 MB (free/total)
free disk space                 : (C:) 132.97 GB
allocated memory                : 709.56 MB
largest free block              : 130989.95 GB
callstack crc                   : $ffe66b7c, $cf324bf4, $cf324bf4
exception number                : 1
exception class                 : EOutOfMemory

main thread ($3fbc):
004094f3 +000 trw.exe
7ffdd5ef +254 user32.dll    DispatchMessageW
7ffdd618 +00e KERNEL32.DLL  BaseThreadInitThunk
7ffdd62c +01b ntdll.dll     RtlUserThreadStart

thread $7410:
7ffdd5f1 +97 user32.dll    MsgWaitForMultipleObjectsEx
7ffdd618 +0e KERNEL32.DLL  BaseThreadInitThunk
7ffdd62c +1b ntdll.dll     RtlUserThreadStart

thread $630c:
7ffdd618 +0e KERNEL32.DLL  BaseThreadInitThunk
7ffdd62c +1b ntdll.dll     RtlUserThreadStart

thread $27a0: <priority:1>
7ffdd618 +0e KERNEL32.DLL  BaseThreadInitThunk
7ffdd62c +1b ntdll.dll     RtlUserThreadStart

thread $7060: <priority:2>
7ffdd5e9 +131 WS2_32.dll  select

thread $1bf8:
7ffdd39a +87 KERNELBASE.dll  WaitForSingleObjectEx
7ffdd4f1 +a7 msvcrt.dll      _endthreadex
7ffdd618 +0e KERNEL32.DLL    BaseThreadInitThunk
7ffdd62c +1b ntdll.dll       RtlUserThreadStart

thread $2c84:
7ffdd39a +87 KERNELBASE.dll  WaitForSingleObjectEx
7ffdd4f1 +a7 msvcrt.dll      _endthreadex
7ffdd618 +0e KERNEL32.DLL    BaseThreadInitThunk
7ffdd62c +1b ntdll.dll       RtlUserThreadStart

thread $2940: <priority:-1>
7ffdd39d +e9 KERNELBASE.dll  WaitForMultipleObjectsEx
7ffdd4f1 +a7 msvcrt.dll      _endthreadex
7ffdd618 +0e KERNEL32.DLL    BaseThreadInitThunk
7ffdd62c +1b ntdll.dll       RtlUserThreadStart

thread $68fc:
7ffdd5f1 +97 user32.dll    MsgWaitForMultipleObjectsEx
7ffdd589 +70 combase.dll   CoWaitForMultipleHandles
7ffdd618 +0e KERNEL32.DLL  BaseThreadInitThunk
7ffdd62c +1b ntdll.dll     RtlUserThreadStart

thread $39fc:
7ffdd618 +0e KERNEL32.DLL  BaseThreadInitThunk
7ffdd62c +1b ntdll.dll     RtlUserThreadStart

thread $7fd8:
7ffdd618 +0e KERNEL32.DLL  BaseThreadInitThunk
7ffdd62c +1b ntdll.dll     RtlUserThreadStart

thread $6dc0:
7ffdd618 +0e KERNEL32.DLL  BaseThreadInitThunk
7ffdd62c +1b ntdll.dll     RtlUserThreadStart

thread $42f8:
7ffdd39a +87 KERNELBASE.dll  WaitForSingleObjectEx
7ffdd618 +0e KERNEL32.DLL    BaseThreadInitThunk
7ffdd62c +1b ntdll.dll       RtlUserThreadStart

thread $483c:
7ffdd39d +e9 KERNELBASE.dll  WaitForMultipleObjectsEx
7ffdd39d +09 KERNELBASE.dll  WaitForMultipleObjects
7ffdd618 +0e KERNEL32.DLL    BaseThreadInitThunk
7ffdd62c +1b ntdll.dll       RtlUserThreadStart

thread $76d4:
7ffdd39c +97 KERNELBASE.dll  SleepEx
7ffdd618 +0e KERNEL32.DLL    BaseThreadInitThunk
7ffdd62c +1b ntdll.dll       RtlUserThreadStart

thread $31f4:
7ffdd5f1 +97 user32.dll    MsgWaitForMultipleObjectsEx
7ffdd618 +0e KERNEL32.DLL  BaseThreadInitThunk
7ffdd62c +1b ntdll.dll     RtlUserThreadStart
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: EOutOfMemory - any idea what could be the reason

Post by madshi »

That seems really weird. The information in the header suggests that there's still plenty of RAM available to be allocated. I can think of 2 possible explanations:

1) Either all of your address range is not allocated, but reserved, which is possible and would block the memory manager from allocating more. But this is not something that usually happens. You don't have madExcept's leak reporting and/or "instantly crash" features activated, do you?

2) Or maybe there's some kind of buffer overrun or other memory corruption going on, which prevents the memory manager from allocating more memory. This might then be raised as an EOutOfMemory exception, but the cause may be some kind of memory corruption instead.

Is there any way you can reproduce this problem on your development machine?

In any case, I'd suggest to enable the madExcept "instantly crash on buffer overrun" feature on your development PC and run your EXE for a while through the usual things users do with it, and see if anything happens. You may get new access violations this way, which would then point to some buffer overruns in your code.
Han312
Posts: 54
Joined: Mon Mar 14, 2016 3:49 pm

Re: EOutOfMemory - any idea what could be the reason

Post by Han312 »

I never used the "instantly crash" feature.

Do you mean with new exceptions some like this one?

Code: Select all

exception class                 : EExternalException
exception message               : Externe Exception 80000003.

main thread ($4420):
77581ee2 +0000 ntdll.dll
004b7ff9 +0019 TRW.exe      madExcept                 InterceptClassDestroy
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: EOutOfMemory - any idea what could be the reason

Post by madshi »

EExternalException is usually raised in situations where the EXE is started from a network or USB drive and the connection to the drive is lost. Could that have happened here? The "instantly crash" feature is supposed to raise EAccessViolation.
Han312
Posts: 54
Joined: Mon Mar 14, 2016 3:49 pm

Re: EOutOfMemory - any idea what could be the reason

Post by Han312 »

No - it was just a normal environment. Nothing unusual.
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: EOutOfMemory - any idea what could be the reason

Post by madshi »

Does the EExternalException happen all the time? Or was it one-time only? Do you get any EAccessViolations when activating "instantly crash"?
Post Reply