1BSON_MEM_SET_VTABLE(3)              libbson             BSON_MEM_SET_VTABLE(3)
2
3
4

SYNOPSIS

6          typedef struct _bson_mem_vtable_t {
7             void *(*malloc) (size_t num_bytes);
8             void *(*calloc) (size_t n_members, size_t num_bytes);
9             void *(*realloc) (void *mem, size_t num_bytes);
10             void (*free) (void *mem);
11             void *(*aligned_alloc) (size_t alignment, size_t num_bytes);
12             void *padding[3];
13          } bson_mem_vtable_t;
14
15          void
16          bson_mem_set_vtable (const bson_mem_vtable_t *vtable);
17

PARAMETERS

19vtable: A bson_mem_vtable_t with every non-padding field set.
20

DESCRIPTION

22       This  function shall install a new memory allocator to be used by Libb‐
23       son.
24
25       For backwards compatibility, if vtable->aligned_alloc is not set, calls
26       to vtable->aligned_alloc will use vtable->malloc instead.
27
28       WARNING:
29          This  function MUST be called at the beginning of the process. Fail‐
30          ure to do so will result in memory being freed by the wrong  alloca‐
31          tor.
32

AUTHOR

34       MongoDB, Inc
35
37       2017-present, MongoDB, Inc
38
39
40
41
421.25.1                           Nov 08, 2023           BSON_MEM_SET_VTABLE(3)
Impressum