KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q42467: If FRE(-2) Returns Small Negative Values, Increase Stack

Article: Q42467
Product(s): See article
Version(s): 4.00 4.00b 4.50
Operating System(s): MS-DOS
Keyword(s): ENDUSER | SR# S890218-1 B_BasicCom | mspl13_basic
Last Modified: 15-DEC-1989

FRE(-2) returns negative values if bytes are added to the stack in
small increments as the stack starts to run out of space. The negative
number is an indication that stack space is extremely low. To increase
stack space use

   CLEAR ,,stacksize

if using QuickBASIC 4.00, 4.00b, or 4.50 or Microsoft BASIC Compiler
Version 6.00 or 6.00b.

If using Microsoft BASIC PDS Version 7.00, you can use either the
CLEAR statement or the STACK statement. For example, to set the stack
size as the program is running use:

   STACK stacksize

where stacksize is the number of bytes that you want for the stack.
The default stack size is in QuickBASIC 4.00, 4.00b, 4.50 and the
BASIC compiler 6.00 and 6.00b is 2000 bytes. The default stacksize in
BASIC PDS 7.00 is 3K under DOS or 3.5K under OS/2 protected mode.
CLEAR also closes all files and releases file buffers, clears all
COMMON variables, sets numeric variables and arrays to zero, sets
string variables to null, and deallocates dynamic arrays. To save
values in variables, use CLEAR to set the stack size in the beginning
of the program. The STACK statement in BASIC PDS 7.00 resets the stack
size without any of the side effects of the CLEAR statement. The stack
space can also be set at link time with the /ST:stacksize option,
where stacksize is the number of bytes in the stack.

This information applies to Microsoft QuickBASIC Versions 4.00, 4.00b,
and 4.50 for MS-DOS, to Microsoft BASIC Compiler Versions 6.00 and
6.00b for MS-DOS and MS OS/2, and to Microsoft BASIC PDS Version 7.00
for MS-DOS and MS OS/2.

THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Copyright Microsoft Corporation 1986-2002.