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 ?