Russell Whitaker wrote:
... snip ...
Next, ran this simple program:
program heaptest; var i: integer; buf: pointer; siz: cardinal;
begin for i := 1 to 255 do begin siz := i * 255 * 255 * 255; getmem( buf, siz); writeln("allocated ", siz," bytes"); freemem( buf ); end; end.
The output was: [..] allocated 1989765000 bytes allocated 2006346375 bytes allocated 2022927750 bytes heaptest: out of heap when allocating 2039509125 bytes (error #853 at 8049e61)
Almost certainly connected with 2GB limits. The memory arena needs some space for itself, besides what has been allocated. There are only 31 bits outside the sign bit in a 32 bit word.