Reduce fixed header size to 2 bytes.

Lets you tell everyone that heap.inc uses 2-byte headers for small blocks. FastMM5 uses 2-byte headers for small blocks, too (although with its constraints it could more easily push for 0‑byte headers than, hypothetically, heap.inc).

Artificial second-best case (best case is GetMem(14)):

var
	a: array of array of byte;
begin
	SetLength(a, 1000 * 1000, {$if sizeof(pointer) > 4} 14 {$else} 6 {$endif});
	with GetFPCHeapStatus do
		writeln('Used / allocated: ', CurrHeapUsed / 1024 / 1024:0:1, ' / ', CurrHeapSize / 1024 / 1024:0:1, ' Mb.');
{$ifdef windows} readln; {$endif}
end.

64-bit: 53.5 / 54.5 Mb38.2 / 38.5 Mb.
32-bit: 34.4 / 34.7 Mb19.1 / 19.7 Mb.

Merge request reports

Loading