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

NAME

6       bson_mem_set_vtable - bson_mem_set_vtable()
7

SYNOPSIS

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

PARAMETERS

22vtable: A bson_mem_vtable_t with every non-padding field set.
23

DESCRIPTION

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

AUTHOR

37       MongoDB, Inc
38
40       2017-present, MongoDB, Inc
41
42
43
44
451.23.1                           Oct 20, 2022           BSON_MEM_SET_VTABLE(3)
Impressum