Alloc
See Also: Memory Management Functions, MemSet
Purpose
Allocates a block of memory.
Return Type
Syntax
Alloc({iBytesAllocated})
Where:
- {iBytesAllocated} is the number of bytes requested.
What It Does
Alloc returns either a pointer to the allocated memory block or zero (if the memory cannot be allocated). The memory is allocated on the process heap in DataFlex.
Example
Pointer aInfo
Char cByteNeeded
Integer iRetVal
Move (Alloc(cByteNeeded)) to aInfo
Move (MemSet(aInfo, 0, cByteNeeded)) to iRetVal
Notes
- Alloc does not initialize the memory block; you have to do that separately.