Microsoft KB Archive/12337

= Explanation of String Space Garbage Collection; FRE Function =

Article ID: 12337

Article Last Modified on 11/21/2006

-

APPLIES TO


 * 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 Q12337



SUMMARY
This article discusses three topics regarding string space compression:


 * 1) When QuickBasic compresses string space during execution of a program
 * 2) Whether disabling string space compression is possible
 * 3) Whether string descriptors are fixed in memory or if they move



MORE INFORMATION

 * 1) When a string variable is assigned a new value, the new string takes the next available memory in string space. The old string value is deallocated but takes up space until string space "garbage collection" occurs.

A program compresses string space as part of "garbage collection" when deallocated strings fill up the 60,000 bytes of available data space and the program needs to reallocate a string variable or a temporary string variable. You can force string compression with the FRE function [PRINT FRE("")], but there is no other way to predict when it will occur. An OPEN or CLOSE of a file can also trigger garbage collection.
 * 1) There is no way to disable the automatic garbage collection. At the time garbage collection occurs, your program is out of memory, so that if you were to disable it, your program could not continue to execute.

You can schedule garbage collection to some extent by using the FRE function before executing code where you do not want garbage collection to occur, but if memory is tight, garbage collection may occur again anyway.
 * 1) String descriptors are the first bytes of each string, and they move as the strings move.

Additional query words: QuickBas BasicCom

Keywords: KB12337

-

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

© Microsoft Corporation. All rights reserved.