{$MEMORY stacksize, heapsize}
https://www.freepascal.org/docs-html/prog/progsu102.htmlThere is also {$MAXSTACKSIZE $FFFF}, but no {$MAXHEAPSIZE $FFFF}
You can set stack and heap size also from the commandline. In that case you can set them separately:
-Ch and -Cs
I your case -Ch8192
In general, TP or FPC in $mode TP,
you should leave the heap alone and just adjust the stack.
The worse you can get from adjusting the heap is EOutOfMemory or an RTE 203.
Just in case of TSR's you might limit the heap.