Re: Fastcode MM B&V 0.34



Hi All & Pierre

I just made this simple realloc validation to test my own super MM.

It reallocs from a small size to a big one and down again and veryfies
that
data in the low part are preserved.

FastMM3 failed.

Somebody could volunteer to enhance it to test many more different sized
reallocs.

function TMMValidation.Validate21 : Boolean;
var
SomeArray : array of Byte;
MemoryStatus : TMemoryStatus;
BytesToAllocate, I1, I2, I3, StartAddress : Cardinal;
const
BYTESTOALLOCATEMIN : Cardinal = 1024;//1 Kbyte
BYTESTOALLOCATEMAX : Cardinal = 1024*1024;//1 Mbyte
FILLBYTE : Byte = 224;

begin
GlobalMemoryStatus(MemoryStatus);
try
if MemoryStatus.dwAvailVirtual >= BYTESTOALLOCATEMAX then
begin
SetLength(SomeArray, BYTESTOALLOCATEMIN);
for I1 := 0 to BYTESTOALLOCATEMIN-1 do
SomeArray[I1] := FILLBYTE;
SetLength(SomeArray, BYTESTOALLOCATEMAX);
for I2 := 0 to BYTESTOALLOCATEMIN-1 do
begin
if SomeArray[I2] <> FILLBYTE then
begin
Result := False;
Exit;
end;
end;
SetLength(SomeArray, BYTESTOALLOCATEMIN);
for I3 := 0 to BYTESTOALLOCATEMIN-1 do
begin
if SomeArray[I3] <> FILLBYTE then
begin
Result := False;
Exit;
end;
end;
end;
except
Result := False;
end;
end;

Regards
Dennis


--
Jeg beskyttes af den gratis SPAMfighter til privatbrugere.
Den har indtil videre sparet mig for at få 75 spam-mails.
Betalende brugere får ikke denne besked i deres e-mails.
Hent den gratis her: www.spamfighter.dk


.