$MaxStackSize Compiler Directive
$MaxStackSize
set the program’s maximum stack
size in bytes. A library ignores this compiler directive because a
DLL does not have its own stack. The default maximum stack size is 1
MB (1048576 bytes), which is more than adequate for most
programs.
Windows creates the stack with the minimum stack size specified with
the $MinStackSize
directive, and the stack grows
as needed, up to the maximum size. If the stack size reaches the
maximum size, Delphi reports runtime error 12
(EStackOverflow
).
In most programs, if you get a stack overflow error, it is due to a software defect, such as unbounded recursion. Check closely for mistakes before you increase the maximum stack size.