Name
$MaxStackSize Compiler Directive
Syntax
{$MaxStackSize Integer
}
Scope
Project
Description
$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.
See Also
$M Compiler Directive, $MinStackSize Compiler Directive |
Get Delphi in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.