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

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

Code

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

Usage

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

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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