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


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s