-
Notifications
You must be signed in to change notification settings - Fork 3
/
RDPMM64.pas
71 lines (54 loc) · 1.59 KB
/
RDPMM64.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
unit RDPMM64;
// 22 Febr 2019 Roberto Della Pasqua www.dellapasqua.com
interface
uses
RDPSimd64;
implementation
const
TBBMalloc = 'SeaMM.DLL';
function SeaMalloc(Size: NativeUint): Pointer; cdecl; external TBBMalloc name 'scalable_malloc';
procedure SeaFreemem(P: Pointer); cdecl; external TBBMalloc name 'scalable_free';
function SeaRealloc(P: Pointer; Size: NativeUint): Pointer; cdecl; external TBBMalloc name 'scalable_realloc';
function QSEAGetMem(Size: Nativeint): Pointer; inline;
begin
Result := SeaMalloc(Size);
end;
function QSEAFreeMem(P: Pointer): Integer; inline;
begin
SeaFreemem(P);
Result := 0;
end;
function QSEAReallocMem(P: Pointer; Size: Nativeint): Pointer; inline;
begin
Result := SeaRealloc(P, Size);
end;
function QSEAAllocMem(Size: Nativeint): Pointer; inline;
begin
Result := SeaMalloc(Size);
if (Result <> nil) then SeaZero(Result, Size);
end;
function QRegisterExpectedMemoryLeak(P: Pointer): Boolean; inline;
begin
Result := False;
end;
function QUnregisterExpectedMemoryLeak(P: Pointer): Boolean; inline;
begin
Result := False;
end;
const
SEAMemoryManager: TMemoryManagerEx = (
Getmem: QSEAGetMem;
Freemem: QSEAFreeMem;
Reallocmem: QSEAReallocMem;
Allocmem: QSEAAllocMem;
RegisterExpectedMemoryLeak: QRegisterExpectedMemoryLeak;
UnregisterExpectedMemoryLeak: QRegisterExpectedMemoryLeak
);
var
OldMemoryManager: TMemoryManagerEx;
initialization
GetMemoryManager(OldMemoryManager);
SetMemoryManager(SEAMemoryManager);
finalization
SetMemoryManager(OldMemoryManager);
end.