</head> <body> <h1>#MaxMem</h1> <p>Sets the maximum capacity of each <a href="../Variables.htm">variable</a> to the specified number of megabytes.</p> <pre class="Syntax"><span class="func">#MaxMem</span> Megabytes</pre> <h2 id="Parameters">Parameters</h2> <dl> <dt>Megabytes</dt> <dd><p>The number of megabytes to allow for each <a href="../Variables.htm">variable</a>. A value larger than 4095 is considered to be 4095. A value less than 1 is considered to be 1.</p></dd> </dl> <h2 id="Remarks">Remarks</h2> <p>If this directive is unspecified in the script, it will behave as though set to 64.</p> <p>The purpose of limiting each variable's capacity is to prevent a buggy script from consuming all available system memory. Raising or lowering the limit does not affect the performance of a script, nor does it change how much memory the script actually uses (except in the case of <a href="WinGetText.htm">WinGetText</a> and <a href="ControlGetText.htm">ControlGetText</a>, which will be capable of retrieving more text if #MaxMem is increased).</p> <p>This setting is global, meaning that it needs to be specified only once (anywhere in the script) to affect the behavior of the entire script.</p> <p>This setting restricts only the automatic expansion that a variable does on its own. It does not affect <a href="VarSetCapacity.htm">VarSetCapacity()</a>.</p> <p>Like other directives, #MaxMem cannot be executed conditionally.</p> <h2 id="Related">Related</h2> <p><a href="VarSetCapacity.htm">VarSetCapacity()</a>, <a href="../Variables.htm">Variables</a>, <a href="Sort.htm">Sort</a>, <a href="WinGetText.htm">WinGetText</a>, <a href="ControlGetText.htm">ControlGetText</a>, <a href="_MaxThreads.htm">#MaxThreads</a></p> <h2 id="Examples">Examples</h2> <div class="ex" id="ExBasic"> <p><a class="ex_number" href="#ExBasic"></a> Allows 256 MB instead of 64 MB per variable.</p> <pre>#MaxMem 256</pre> </div> <div class="ex" id="ExMaxedMem"> <p><a class="ex_number" href="#ExMaxedMem"></a> Allows the maximum amount of MB per variable.</p> <pre>#MaxMem 4095</pre> </div> </body> </html>