RAD Studio (Common)
ContentsIndex
PreviousUpNext
Memory allocation sizes (Delphi)
Type  
Parameter  
Syntax  
{$M minstacksize,maxstacksize} {$MINSTACKSIZE number} {$MAXSTACKSIZE number}  
Default  
{$M 16384,1048576}  
Scope  
Global  

Remarks 

The $MINSTACKSIZE and $MAXSTACKSIZE directives are used in Win32 programming only.  

The $M directive specifies an application's stack allocation parameters. minstacksize must be an integer number between 1024 and 2147483647 that specifies the minimum size of an application's stack, and maxstacksize must be an integer number between minstacksize and 2147483647 that specifies the maximum size of an application's stack. 

If there is not enough memory available to satisfy an application's minimum stack requirement, Windows will report an error upon attempting to start the application. 

An application's stack is never allowed to grow larger than the maximum stack size. Any attempt to grow the stack beyond the maximum stack size causes an EStackOverflow exception to be raised. 

The $MINSTACKSIZE and $MAXSTACKSIZE directives allow the minimum and maximum stack sizes to be specified separately.  

The memory allocation directives are meaningful only in a program. They should not be used in a library or a unit. 

For portability considerations between Windows and Linux, you should use the long forms of these directives instead of $M. 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!