gobj_set_allocators()

gobj_set_allocators()#

Sets custom memory allocation functions for the system, replacing the default allocators.

Prototype

int gobj_set_allocators(
    sys_malloc_fn_t  malloc_func,
    sys_realloc_fn_t realloc_func,
    sys_calloc_fn_t  calloc_func,
    sys_free_fn_t    free_func
);

Parameters

Key

Type

Description

malloc_func

sys_malloc_fn_t

Function pointer for memory allocation.

realloc_func

sys_realloc_fn_t

Function pointer for memory reallocation.

calloc_func

sys_calloc_fn_t

Function pointer for memory allocation with zero initialization.

free_func

sys_free_fn_t

Function pointer for memory deallocation.


Return Value

Returns 0 on success.

Notes

This function allows replacing the default memory management functions with custom implementations.

Prototype

// Not applicable in JS

Prototype

# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples