mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-29 05:40:01 +02:00
* PS1: clamp the stack size, so it doesn't exceed the maximum memory available (minus 1k for heap)
This commit is contained in:
parent
73aa2fd266
commit
94e399faf7
@ -109,8 +109,16 @@ begin
|
||||
end;
|
||||
|
||||
function CheckInitialStkLen(stklen : SizeUInt) : SizeUInt;
|
||||
const
|
||||
MinHeap = 1024; // always leave at least 1k heap
|
||||
var
|
||||
MaxStack: SizeInt;
|
||||
begin
|
||||
result:= stklen;
|
||||
MaxStack:=SizeInt(PtrUInt($80200000)-PtrUInt(@bss_end))-MinHeap;
|
||||
if stklen<MaxStack then
|
||||
result:= stklen
|
||||
else
|
||||
result:=MaxStack;
|
||||
end;
|
||||
|
||||
procedure system_exit;
|
||||
|
Loading…
Reference in New Issue
Block a user