Penulis Topik: [Delphi] Memory Manager di Windows  (Dibaca 378 kali)

Offline descrates

  • Pro500
  • ******
  • Tulisan: 615
  • Reputation: 5073
    • Lihat Profil
[Delphi] Memory Manager di Windows
« pada: Juli 01, 2017, 02:54:51 PM »
di delphi banyak memory manager, dari yang native FastMM sampai scaleMM
dan semua kurang greget jatuhnya (kalau melihat perkembangan)
nah gw juga gitu, awalnya pakai FastMM tapi makin jatuh performance
terus gw doping pakai msvcrtMM, lumayan ngangkat karena inget MinGW
tapi karena butuh yang strong, maka pilihan gw: msvcrtMM + QiuMM
jadilah tandem yang lumayan

yang msvcrtMM.pas (msvcrt100 keatas)

---------------------------------------------
unit msvcrtMM;

interface

implementation

type
  size_t = Cardinal;

const
  msvcrtDLL = 'msvcr100.dll';

function malloc(Size: size_t): Pointer; cdecl; external msvcrtDLL;
function realloc(P: Pointer; Size: size_t): Pointer; cdecl; external msvcrtDLL;
procedure free(P: Pointer); cdecl; external msvcrtDLL;

function GetMem(Size: Integer): Pointer;
begin
  Result := malloc(size);
end;

function FreeMem(P: Pointer): Integer;
begin
  free(P);
  Result := 0;
end;

function ReallocMem(P: Pointer; Size: Integer): Pointer;
begin
  Result := realloc(P, Size);
end;

function AllocMem(Size: Cardinal): Pointer;
begin
  Result := GetMem(Size);
  if Assigned(Result) then begin
    FillChar(Result^, Size, 0);
  end;
end;

function RegisterUnregisterExpectedMemoryLeak(P: Pointer): Boolean;
begin
  Result := False;
end;

const
  MemoryManager: TMemoryManagerEx = (
    GetMem: GetMem;
    FreeMem: FreeMem;
    ReallocMem: ReallocMem;
    AllocMem: AllocMem;
    RegisterExpectedMemoryLeak: RegisterUnregisterExpectedMemoryLeak;
    UnregisterExpectedMemoryLeak: RegisterUnregisterExpectedMemoryLeak
  );

initialization
  SetMemoryManager(MemoryManager);

end.
---------------------------------------------

QiuMM

https://code.google.com/archive/p/qiumm/source/default/source


TASKKILL /F /IM SMĪ”RTP.exe /T

Win7 32bit [kernel patch] --- 2x2,8GHz Intel --- 8GB RAM DDR3 --- 512MB 9600M GT NVidia --- Iron 15 beta --- Opera Mini Proxies

other OS: Lucid Puppy, XP SP2 [custom], XP SP3, Win7 64bit, Tails