_FreeHand( ), API-Bibliotheksroutine

Gibt das Speicherhandle hand frei, das zuvor reserviert wurde, z. B. durch _AllocHand( ).

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

Beispiel

Im folgenden Beispiel werden 1024 Blöcke von Speicherblöcken mit jeweils 16384 Bytes, also insgesamt 16 MB, reserviert, wobei jeder Speicherblock mit _FreeHand( ) freigegeben wird, bevor der nächste Block reserviert wird.

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
};

Siehe auch

_AllocHand( ), API-Bibliotheksroutine | _GetHandSize( ), API-Bibliotheksroutine | _HandToPtr( ), API-Bibliotheksroutine | _HLock( ), API-Bibliotheksroutine | _HUnlock( ), API-Bibliotheksroutine | _MemAvail( ), API-Bibliotheksroutine | _SetHandSize( ), API-Bibliotheksroutine