Futurebasic/Language/Reference/compress dynamic
COMPRESS DYNAMIC statement
[edit | edit source]COMPRESS DYNAMIC
[edit | edit source]Statement
[edit | edit source]✔ Appearance ✔ Standard ✔ Console
Syntax
[edit | edit source]COMPRESS DYNAMIC arrayName
Revised:
May, 2001 (Release 5)
Description
[edit | edit source]When space is required for a dynamic array, it is allocated in chunks. The size of these chunks is determined by the global variable gFBDynamicGrowInc&
. If gFBDynamicGrowInc&
is set to 1000 and you use a single element, 1000 elements are allocated. No additional elements are allocated unless and until you pass the 1000 mark. If you needed to access the 1001st element, an additional 1000 elements would be allocated.
The preallocation of space in large chunks can make dynamic arrays operate at a much faster pace because the handle used to accommodate the information is not resized as often.
When you want to regain RAM set aside for a dynamic array that has not yet been addressed, use COMPRESS DYNAMIC
. The size of the handle used to hold information is reduced. Internal counters that track the maximum number of elements available before resizing are also corrected.