table of contents
| BSON_ARRAY_ALLOC(3) | libbson | BSON_ARRAY_ALLOC(3) |
SYNOPSIS¶
#define BSON_ARRAY_ALLOC(Count, Type) \
(Type*) bson_array_alloc (Count, sizeof (Type)) void * bson_array_alloc (size_t num_elems, size_t elem_size);
PARAMETERS¶
- num_elems: A size_t containing the number of objects to allocate.
- elem_size: A size_t containing the size of each object in bytes.
DESCRIPTION¶
This is a portable malloc() wrapper to allocate an array of objects.
If num_elems * elem_size cannot be represented in a size_t or there was a failure to allocate num_elems * elem_size bytes, the process will be aborted.
Warning:
This function will abort on failure to allocate
memory.
RETURNS¶
A pointer to a memory region which HAS NOT been zeroed.
Author¶
MongoDB, Inc
Copyright¶
2009-present, MongoDB, Inc.
| November 26, 2025 | 2.2.0 |