implementation
var
- hProcessHeap: Cardinal;
OldMemMgr: TMemoryManager;
function NewGetMem(Size: Integer): Pointer;
begin
- Result := HeapAlloc(hProcessHeap,0,Size);
+ Result := Pointer(GlobalAlloc(GMEM_FIXED,Size));
end;
function NewFreeMem(P: Pointer): Integer;
begin
- if HeapFree(hProcessHeap,0,P) then Result := 0
- else Result := 1;
+ Result := GlobalFree(HGLOBAL(P));
end;
function NewReallocMem(P: Pointer; Size: Integer): Pointer;
begin
- Result := HeapRealloc(hProcessHeap,0,P,Size);
+ Result := Pointer(GlobalReAlloc(HGLOBAL(P),Size,GMEM_MOVEABLE));
end;
const
ReallocMem: NewReallocMem);
initialization
- hProcessHeap := GetProcessHeap();
-
GetMemoryManager(OldMemMgr);
SetMemoryManager(NewMemMgr);