Microsoft KB Archive/31159

= &quot;Out of Data Space [or Memory]&quot;; OPEN Files Consume Memory =

Article ID: 31159

Article Last Modified on 11/21/2006



This article was previously published under Q31159



SUMMARY
When a program is running, each file OPENed with the OPEN statement takes up memory for the file buffer in DGROUP. If you specify a large record length (with the LEN= clause), a corresponding large space will be taken up in DGROUP.

When OPENed file buffers consume all of DGROUP memory at run time, one of the following error messages will display: Version  In QB.EXE Environment     From .EXE Compiled Program

3.00     &quot;Out of memory&quot;             &quot;Out of memory in module&quot; 4.00     &quot;Out of data space&quot;         &quot;Out of memory in module&quot; 4.00b    &quot;Out of data space&quot;         &quot;Out of memory in module&quot; 4.50     &quot;Out of data space&quot;         &quot;Out of memory in module&quot; The Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS and OS/2 will behave like QuickBasic Version 4.00b.

To work around this problem, do the following:


 * 1) CLOSE each file before OPENing the next. Closing the file will free up the DGROUP memory that it used.
 * 2) Use the CLEAR command to CLOSE all files and erase all variables.
 * 3) Reduce the record length size (LEN=reclen) in the OPEN statement.
 * 4) Make numeric arrays $DYNAMIC instead of $STATIC. This will leave more space in DGROUP.



MORE INFORMATION
The following code demonstrates the problem: CLS : CLOSE PRINT &quot;Amount of available string space&quot;;FRE(&quot;&quot;) OPEN &quot;z1&quot; FOR RANDOM AS 1 OPEN &quot;z2&quot; FOR RANDOM AS 2 LEN = 5000; OPEN &quot;z3&quot; FOR OUTPUT AS 3 OPEN &quot;z4&quot; FOR OUTPUT AS 4 LEN = 5000 OPEN &quot;z6&quot; FOR BINARY AS 6 PRINT &quot;Amount of available string space&quot;;FRE(&quot;&quot;)

Additional query words: QuickBas BasicCom

Keywords: KB31159

-

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

© Microsoft Corporation. All rights reserved.