pub unsafe extern "C" fn ch_set_allocator(
    alloc_func: ch_alloc_t,
    free_func: ch_free_t
) -> ch_error_t
Expand description

Set the allocate and free functions used by Chimera for allocating memory at runtime for stream state, scratch space, database bytecode, and various other data structure returned by the Chimera API.

The function is equivalent to calling @ref ch_set_scratch_allocator(), @ref ch_set_database_allocator() and @ref ch_set_misc_allocator() with the provided parameters.

This call will override any previous allocators that have been set.

Note: there is no way to change the allocator used for temporary objects created during the various compile calls (@ref ch_compile() and @ref ch_compile_multi()).

@param alloc_func A callback function pointer that allocates memory. This function must return memory suitably aligned for the largest representable data type on this platform.

@param free_func A callback function pointer that frees allocated memory.

@return @ref CH_SUCCESS on success, other values on failure.