Explanation of Compiler "Bytes Available" and "Bytes Free"

ID: Q27347


The information in this article applies to:
  • Microsoft Visual Basic Standard and Professional Editions for MS-DOS, version 1.0
  • Microsoft QuickBASIC for MS-DOS, versions 2.0, 2.01, 3.0
  • Microsoft BASIC Compiler for MS-DOS and MS OS/2, versions 6.0, 6.0b
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2, versions 7.0, 7.1
  • Microsoft BASIC Compiler for MS-DOS, versions 5.35, 5.36


SUMMARY

At the end of a successful compilation, the BC.EXE compiler displays the following message:


   nnnnn Bytes Available
   nnnnn Bytes Free

          0 Warning Error(s)
          0 Severe Error(s) 
This message gives the amount of compiler workspace available before (Bytes Available) and after (Bytes Free) a program is compiled.

If Bytes Free is approaching 1024 or less, then the compiler is reaching internal workspace limits in generating code for this module.

As your program approaches the compiler's limits, you should break your program into smaller, separately compiled modules that contain callable SUBprogram or FUNCTION procedures. The main module can CALL the procedures in the support module(s). The separate support .OBJ modules must be linked with your main module.

You can also break your program into smaller .EXE programs that use the CHAIN statement to transfer control from one .EXE program to another.

Note that BC.EXE can give you a "Program-memory overflow" or "Out of Memory" error at compile time when there are still plenty of "Bytes Free". This happens when the compiler has enough workspace but the code segment that it generates exceeds 64K. (To monitor how close the code segment size is growing toward 64K, you can check the size of the BC_CODE item in the linker's optional .MAP file, but only after compiling and linking with no errors.)

To work around this 64K-per-module code-generation limitation, you need to break the program into separately compiled (.OBJ) modules containing called procedures, or into separately compiled main .EXE programs that can run each other with the CHAIN statement.

This information applies to BC.EXE in the Standard and Professional Editions of Microsoft Visual Basic for MS-DOS version 1.0; to BC.EXE in Microsoft QuickBasic for MS-DOS versions 4.0, 4.0b, and 4.5; to BC.EXE in Microsoft Basic Compiler for MS-DOS and MS OS/2 versions 6.0, 6.0b; to BC.EXE in Microsoft Basic Development System (PDS) for MS-DOS and MS OS/2 versions 7.0 and 7.1; to QB.EXE in Microsoft QuickBasic for MS-DOS versions 2.0, 2.01 and 3.0; and to BASCOM.EXE in Microsoft Basic Compiler for MS-DOS versions 5.35 and 5.36.


MORE INFORMATION

The 64K memory segmentation architecture of the 8086 chip has influenced design limitations of the Basic compiler so that it can use only 64K blocks for internal compiler workspace, and can generate only 64K or less for a program's code segment.

Bytes Available is the initial amount of compiler workspace available for storing the symbol table and the line number table, and for working storage for code generation and optimization.

Bytes Free is the size of unused compiler workspace after the compiler has finished.

NOTE: The number of bytes that BC.EXE generated for a module's code segment is NOT indicated by the size of the .OBJ file on disk. Instead, you must refer to the .MAP file that can be optionally output from the LINK.EXE linker. The program must have been successfully compiled and linked to get a valid link .MAP file. Your module will be listed by name in the .MAP file under a "BC_CODE" Class, and its code segment size will be shown in hexadecimal (base 16) notation in the Length column.

Additional query words: VBmsdos BasicCom

Keywords :
Version : MS-DOS:1.0,2.0,2.01,3.0; :5.35,5.36,6.0,6.0b,7.0,7.1
Platform : MS-DOS
Issue type :


Last Reviewed: December 10, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.