Allocates memory that will be collected by the garbage collector.
#include "hbapi.h" void * hb_gcAlloc( HB_SIZE nSize, HB_GARBAGE_FUNC_PTR pCleanupFunc );
<ulSize> Requested size of memory block
<pCleanupFunc> Pointer to HB_GARBAGE_FUNC function that will be called directly before releasing the garbage memory block or NULL. This function should release all other memory allocated and stored inside the memory block. For example, it releases all items stored inside the array. The functions receives a single parameter: the pointer to memory allocated by hb_gcAlloc().
The pointer to allocated memory or it generates an internal unrecoverable error.
hb_gcAlloc() is used to allocate the memory that will be tracked by the garbage collector. It allows to properly release memory in case of self-referencing or cross-referencing harbour level variables. Memory allocated with this function should be released with hb_gcFree() function or it will be automatically deallocated by the GC if it is not locked or if it is not referenced by some harbour level variable.