0

When I run my application sometimes it pops out "Out of memory" dialog and opens System.pas and stays in the TEST EAX,EAX line.

function _GetMem(Size: Integer): Pointer;
{$IFDEF PUREPASCAL}
{$IF Defined(DEBUG) and Defined(LINUX)}
var
  Signature: PLongInt;
{$IFEND}
begin
  if Size > 0 then
  begin
{$IF Defined(DEBUG) and Defined(LINUX)}
    Signature := PLongInt(MemoryManager.GetMem(Size + 4));
    if Signature = nil then
      Error(reOutOfMemory);
    Signature^ := 0;
    Result := Pointer(LongInt(Signature) + 4);
{$ELSE}
    Result := MemoryManager.GetMem(Size);
    if Result = nil then
      Error(reOutOfMemory);
{$IFEND}
  end
  else
    Result := nil;
end;
{$ELSE}
asm
        TEST    EAX,EAX
        JLE     @@negativeorzerosize
{$IFDEF ALIGN_STACK}
        SUB ESP, 12
{$ENDIF ALIGN_STACK}
        CALL    MemoryManager.GetMem
{$IFDEF ALIGN_STACK}
        ADD ESP, 12
{$ENDIF ALIGN_STACK}
        TEST    EAX,EAX
        JZ      @@getmemerror
        DB      $F3
        RET
@@getmemerror:
        MOV     AL,reOutOfMemory
        JMP     Error
@@negativeorzerosize:
        XOR     EAX, EAX
        DB      $F3
end;
{$ENDIF}

Did anyone face with it ? I think this issue caused by ERS compiler but is there any hotfixes ?

Johan
  • 74,508
  • 24
  • 191
  • 319
Suhrob Samiev
  • 1,528
  • 1
  • 25
  • 57
  • Have you checked if you are actually running out of memory (do you have a memory leak?) – Gregor Brandt Oct 28 '13 at 04:16
  • No,I don't have any problems with memory. I monitored via task manager there was plenty of memories. I have 8 GB RAM and only running my IDE. – Suhrob Samiev Oct 28 '13 at 05:13
  • codeguard generated the following: – Suhrob Samiev Oct 28 '13 at 05:22
  • Error 00177. 0x820000 (Thread 0x05D0): Function failure: SysGetMem(0x49390F [4798735])=0x00000000 Call Tree: 0x00492942(=PassReader.exe:0x01:091942) System.pas#2979 0x005CB0E9(=PassReader.exe:0x01:1CA0E9) 0x0045F332(=PassReader.exe:0x01:05E332) Classes.pas#13015 0x772762FA(=USER32.DLL:0x01:0062FA) 0x77276D3A(=USER32.DLL:0x01:006D3A) 0x77276DE8(=USER32.DLL:0x01:006DE8) – Suhrob Samiev Oct 28 '13 at 05:23
  • If your program is multi-threaded, code guard is not useful. See QC 68759, so the code guard report is incorrect. Have you followed the stack trace back to see what in your code is eventually calling SysGetMem()? There is just not enough info to help out more! For instance, how much memory is attempted to be allocated? – Gregor Brandt Oct 28 '13 at 14:10
  • Also, the code you posted above is well used and (presumably) well tested. I would look for the error somewhere else that is causing this issue. – Gregor Brandt Oct 28 '13 at 18:39
  • Does the following output config of project cause such exception ? I have set them when it came with third party sdk which they have configured in such way increasing min heap size and so on.. Please just look at the following pic: http://www.flickr.com/photos/67246820@N08/10548409105/lightbox/ – Suhrob Samiev Oct 29 '13 at 02:56
  • default min stack size also have changed .. – Suhrob Samiev Oct 29 '13 at 02:56

0 Answers0