AllocateMemory()
Syntax
*Buffer = AllocateMemory(Size [, Flags])Description
Allocates a contiguous memory area with the specified size in bytes. The new memory area will be cleared and filled with zeros.
Parameters
Size The size in bytes for the new memory area. Flags (optional) It can be one of the following values: #PB_Memory_NoClear: don't fill the new memory area with zeros. It can help to have faster allocation if the allocated memory is used immediately.
Return value
Returns the address of the allocated memory, or zero if the memory cannot be allocated.
Remarks
FreeMemory() can be used to return the allocated memory back to the system. All the allocated memory areas are automatically freed when the programs ends.
Example
*Buffer = AllocateMemory(5000) If *Buffer PokeS(*Buffer, 0, "Store this string in the memory buffer") ; Read it back Debug PeekS(*Buffer, 0) FreeMemory(*Buffer) ; will also be done automatically at the end of program Else Debug "Couldn't allocate the requested memory!" EndIf
See Also
FreeMemory(), MemorySize()
Supported OS
All