Function hyperscan_sys::chimera::ch_set_database_allocator
source · [−]pub unsafe extern "C" fn ch_set_database_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 for database bytecode produced by the compile calls (@ref ch_compile() and @ref ch_compile_multi()).
If no database allocation functions are set, or if NULL is used in place of both parameters, then memory allocation will default to standard methods (such as the system malloc() and free() calls).
This call will override any previous database allocators that have been set.
Note: the database allocator may also be set by calling @ref ch_set_allocator().
Note: there is no way to change how temporary objects created during the various compile calls (@ref ch_compile() and @ref ch_compile_multi()) are allocated.
@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 HS_SUCCESS on success, other values on failure.