{$MODE FPC}
{$MODESWITCH OUT}
{$MODESWITCH RESULT}
unit dmemory;

interface

function TryGetMem(Size: SizeUInt): Pointer;

implementation

function TryGetMem(Size: SizeUInt): Pointer;
var
  SavedReturnNilIfGrowHeapFails: Boolean;
begin
  SavedReturnNilIfGrowHeapFails := ReturnNilIfGrowHeapFails;
  ReturnNilIfGrowHeapFails := True;
  Result := GetMem(Size);
  ReturnNilIfGrowHeapFails := SavedReturnNilIfGrowHeapFails;
end;

end.
