Compacting Memory

You can use the following function to defragment memory, making the maximum available to your program, before beginning any operation that will require a lot of memory.


Declare Function GlobalCompact Lib "Kernel" (ByVal dwMinFree&) As Long


Sub CompactMemory ()
     Dim R As Long
     R = GlobalCompact(&HFFFFFFFF)
End Sub


Call CompactMemory


This tip is reprinted from the VB Tips & Tricks Volume 1 book.

Compatible With Visual Basic 3.0, Visual Basic 4.0 16-bit
Applies To Windows 3