BSON_ARRAY_ALLOC0(3)

SYNOPSIS

            #define BSON_ARRAY_ALLOC0(Count, Type) \
               (Type*) bson_array_alloc0 (Count, sizeof (Type))

            void *
            bson_array_alloc0 (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 calloc() wrapper to allocate an array of objects that also sets the memory to zero.

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 been zeroed.

Author
MongoDB, Inc

Copyright
2009-present, MongoDB, Inc.