Compartir a través de


_FreeHand( ) API Library Routine

Releases a memory handle hand previously allocated by means such as _AllocHand( ).

void _FreeHand(MHANDLE hand)
MHANDLE hand;            /* Memory handle. */

Example

The following example allocates 1024 blocks of 16384-byte memory blocks, for a total of 16 MB, freeing each memory block using _FreeHand( ) before allocating the next.

Visual FoxPro Code

SET LIBRARY TO FREEHAND

C Code

#include <pro_ext.h>

void FAR Example(ParamBlk FAR *parm)
{
   MHANDLE mh;
   int i;

   for (i = 0; i < 1024; i++)
   {
      if ((mh = _AllocHand(16384)) == 0)
      {
         _Error(182);  // "Insufficient memory"
      }
      _FreeHand(mh);
   }
}

FoxInfo myFoxInfo[] = {
   {"ONLOAD", (FPFI) Example, CALLONLOAD, ""},
};
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};

See Also

Reference

_AllocHand( ) API Library Routine

_GetHandSize( ) API Library Routine

_HandToPtr( ) API Library Routine

_HLock( ) API Library Routine

_HUnLock( ) API Library Routine

_MemAvail( ) API Library Routine

_SetHandSize( ) API Library Routine

Other Resources

API Library Construction