This call frees memory previously allocated by DosSubAlloc.

Syntax

DosSubFree (SegSelector, BlockOffset, Size)

Parameters

;SegSelector (SEL) - input : Data segment selector. ;BlockOffset (USHORT) - input : Memory block offset. The value specified must equal the BlockOffset returned on a previous DosSubAlloc call. ;Size (USHORT) - input : Size, in bytes, of the block to be freed.

Return Code

rc (USHORT) - return Return code descriptions are: * 0 NO_ERROR * 312 ERROR_DOSSUB_OVERLAP * 313 ERROR_DOSSUB_BADSIZE

Remarks

DosSubFree specifies the offset of a block of memory previously suballocated by a DosSubAlloc request. If the block specified overlaps memory in the segment that is not suballocated, an error is returned. Like DosSubAlloc, the size parameter must be a multiple of four bytes; otherwise, it is rounded up to a multiple of four bytes.

The allocated segment is freed by calling DosFreeSeg.

Example Code

C Binding

<PRE> #define INCL_DOSMEMMGR

USHORT rc = DosSubFree(SegSelector, BlockOffset, Size);

SEL SegSelector; /* Segment selector */ USHORT BlockOffset; /* Offset of memory block to free */ USHORT Size; /* Size of block in bytes */

USHORT rc; /* return code */ </PRE>

MASM Binding

<PRE> EXTRN DosSubFree:FAR INCL_DOSMEMMGR EQU 1

PUSH WORD SegSelector ;Segment selector PUSH WORD BlockOffset ;Offset of memory block to free PUSH WORD Size ;Size of block in bytes CALL DosSubFree

Returns WORD </PRE>

Note

Text based on http://www.edm2.com/index.php/DosSubFree

Family API
DOS	Process Manager	DosBeep DosExit DosSleep DosExecPgm
File Manager	DosChDir DosChgFilePtr DosClose DosDelete DosDupHandle DosMkDir DosMove DosQCurDir DosQCurDisk DosSetFileMode DosOpen DosQFileInfo DosRead DosQFileMode DosQFSInfo DosQVerify DosRmDir DosSelectDisk DosFindClose DosFindFirst DosFindNext DosSetFileInfo DosSetVerify DosWrite DosFileLocks DosSetFHandState DosNewSize DosBufReset DosQFHandState DosSetFSinfo DosShutdown
Memory Manager	DosFreeSeg DosSubAlloc DosSubFree DosSubSet DosAllocHuge DosAllocSeg DosReallocHuge DosReallocSeg DosGetHugeShift DosCreateCSAlias
NLS	DosCaseMap DosGetCtryInfo DosGetDBCSEv DosSetCtryCode DosGetCollate DosGetMessage DosInsMessage DosPutMessage
Date and Time	DosSetDateTime DosGetDateTime
Devices	DosDevConfig DosDevIOCtl DosDevIOCtl2
Signals	DosHoldSignal DosSetSigHandler
Misc	BadDynLink DosGetEnv DosGetMachineMode DosGetVersion DosError DosErrClass DosSetVec
KBD	KbdCharIn KbdFlushBuffer KbdGetStatus KbdSetStatus KbdStringIn KbdPeek
VIO	VioGetBuf VioGetConfig VioGetCurPos VioGetCurType VioGetPhysBuf VioReadCellStr VioReadCharStr VioScrollUp VioScrollDn VioScrollLf VioScrollRt VioScrUnLock VioSetCurPos VioSetCurType VioSetMode VioGetMode VioShowBuf VioWrtCellStr VioWrtCharStr VioWrtCharStrAtt VioWrtNAttr VioWrtNCell VioWrtNChar VioWrtTTY VioScrLock VioPopUp
Tools	BIND
Modules	DOSCALLS.DLL VIOCALLS.DLL KBDCALLS.DLL MSG.DLL
Libraries	API.LIB OS2386.LIB FAPI.LIB DOSCALLS.LIB SUBCALLS.LIB