4.5.2. besALLOC(X)

[<<<] [>>>]

Use this macro to allocate memory in an extension like you would use malloc in a normal, old fashioned C program. The argument is the size of the memory in byte count to be allocated. The result is the pointer to the allocated memory or NULL if there is not enough memory available.

The allocated memory is assigned to the memory segment of the execution thread and thus this memory is released automatically when the module is unloaded from the interpreter. In other words if a module uses besALLOC to allocate memory there is no need to call @xref{besFREE(X)}.

Modules written for multi-thread variations of ScriptBasic should also be aware of the fact that the memory allocated by this macro is released whent he calling interpreter thread finishes.

This macro calls the function @xref{alloc_Alloc()}


[<<<] [>>>]