unit ddefaultallocator;

interface

type
// Uses allocator from fpc the RTL
TDefaultAllocator = object
public
  procedure Init(AllocatorData: Pointer); static; inline;
  procedure Done; static; inline;
  function Allocate(Size: SizeUInt; Hint: Pointer = nil): Pointer; static; inline;
  procedure DeAllocate(P: Pointer; Size: SizeUInt); static; inline;
  function ReAlloc(P: Pointer; OldSize, NewSize: SizeUInt): Pointer; static; inline;
end;

implementation

procedure TDefaultAllocator.Init(AllocatorData: Pointer);
begin
end;

procedure TDefaultAllocator.Done;
begin
end;

function TDefaultAllocator.Allocate(Size: SizeUInt; Hint: Pointer = nil): Pointer;
begin
  Result := System.GetMem(Size);
end;

procedure TDefaultAllocator.DeAllocate(P: Pointer; Size: SizeUInt);
begin
  System.FreeMem(P, Size);
end;

function TDefaultAllocator.ReAlloc(P: Pointer; OldSize, NewSize: SizeUInt): Pointer; static; inline;
begin
  Result := System.ReAllocMem(P, NewSize);
end;

end.
