Memory functions

## Functions

AS_API int | asSetGlobalMemoryFunctions (asALLOCFUNC_t allocFunc, asFREEFUNC_t freeFunc)
| Set the memory management functions that AngelScript should use. More...
AS_API int | asResetGlobalMemoryFunctions ()
| Remove previously registered memory management functions. More...
AS_API void * | asAllocMem (size_t size)
| Allocate memory using the memory function registered with AngelScript. More...
AS_API void | asFreeMem (void *mem)
| Deallocates memory using the memory function registered with AngelScript. More...

## Detailed Description

## Function Documentation

## asAllocMem()

AS_API void* asAllocMem | ( | size_t | size | ) |

Parameters

  [in] | size | The size of the buffer to allocate

Returns
  A pointer to the allocated buffer, or null on error.

## asFreeMem()

AS_API void asFreeMem | ( | void * | mem | ) |

Parameters

  [in] | mem | A pointer to the buffer to deallocate

## asResetGlobalMemoryFunctions()

AS_API int asResetGlobalMemoryFunctions | ( |  | ) |

Returns
  A negative value on error.

Call this method to restore the default memory management functions.

## asSetGlobalMemoryFunctions()

AS_API int asSetGlobalMemoryFunctions | ( | asALLOCFUNC_t | allocFunc,
|  | asFREEFUNC_t | freeFunc
| ) |  |

Parameters

  [in] | allocFunc | The function that will be used to allocate memory.
  [in] | freeFunc | The function that will be used to free the memory.

Returns
  A negative value on error.

Call this method to register the global memory allocation and deallocation functions that AngelScript should use for memory management. This function should be called before asCreateScriptEngine.

If not called, AngelScript will use the malloc and free functions from the standard C library.