FUNCTION MemGrpCAlloc( wGroup AS DWORD, wItems AS DWORD, wBytes AS DWORD ) AS IntPtr
public static IntPtr MemGrpCAlloc( uint wGroup, uint wItems, uint wBytes )
The Static Memory Functions (MemAlloc, MemSet etc) are included for compatibility only.
In most cases the static memory blocks can (and should) be replaced with arrays of bytes.|
Many of the functions in the runtime that take memory blocks as parameter, such as the low level IO functions, now have overloads that take arrays of bytes as parameter.
We recommend that you use these overloads, because their performance is somewhat better.
LOCAL ptrLongs AS PTR ptrLongs := MemCAlloc(10, 4)
ptrLongs := MemCAlloc(10, _SizeOf(LONG))
STRUCTURE StatInfo MEMBER wAverageHit AS DWORD MEMBER wMaxHit AS DWORD MEMBER wMinHit AS DWORD FUNCTION MemCAlloc2() AS VOID LOCAL ptrStruct AS PTR ptrStruct := MemCAlloc(5, _SizeOf(StatInfo)) IF ptrStruct = NULL_PTR ? "Allocation failed" ELSE MemFree(ptrStruct) ENDIF