Microsoft KB Archive/21902

= SHELL Can Give "Out of Memory" Error or Fragment Memory =

Article ID: 21902

Article Last Modified on 11/21/2006

-

APPLIES TO


 * Microsoft QuickBasic 2.0
 * Microsoft QuickBasic 2.01
 * Microsoft QuickBasic 3.0
 * Microsoft QuickBasic 4.0
 * Microsoft QuickBASIC 4.0b
 * Microsoft QuickBasic 4.5 for MS-DOS
 * Microsoft BASIC Compiler 6.0
 * Microsoft BASIC Compiler 6.0b
 * Microsoft BASIC Professional Development System 7.0

-



This article was previously published under Q21902



SUMMARY
Question:

Why do I get an "Out of Memory" error when I use the SHELL statement or the Shell command?

Response:

The SHELL statement does not clean up or compress memory. If not enough contiguous memory is available (for example, if many CHAIN statements have been executed, or several dynamic arrays were allocated then erased), a SHELL statement may fail with an "Out of memory" error. This includes both the Shell command from the File menu and also the SHELL statement in a running program.

Also, if you mistakenly install any TSR (terminate and stay resident) program during a SHELL command, you will fragment memory, which often results in an "Out of Memory" error. For example, if you run the QuickBasic environment, choose the Shell command from the File menu, install a TSR, EXIT the Shell, Exit the QuickBasic environment, and reinvoke the QuickBasic environment from DOS, then you get an "Out of Memory" error immediately before you can do anything in the environment. You must reboot to unfragment DOS memory.

This information applies to Microsoft QuickBasic Versions 2.00, 2.01, 3.00, 4.00, 4.00b, and 4.50, to Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS, and to Microsoft Basic PDS Version 7.00 for MS-DOS.

TSR programs should NEVER be installed during a SHELL statement or a Shell from the File menu. Examples of TSR programs are MSHERC.COM (from QuickBasic 4.50) and QBHERC.COM (from QuickBasic 4.00/4.00b and the Basic compiler 6.00/6.00b).

Additional query words: QuickBas BasicCom

Keywords: KB21902

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.