Back to libut API Reference


SYNOPSIS

    #include "libut/ut.h"
    void* UT_mem_alloc(char *poolname, int num_bufs);


DESCRIPTION

This function allocates num_bufs contiguous buffers from the memory pool poolname, which must have been previously established using UT_mem_pool_create(3). The returned void* is the address of the first buffer.

This function returns only when memory allocation was successful. If it was not, because an invalid poolname was specified or because insufficient free memory is available to satisfy the request, then a Fatal message is logged and the process exits.


RELATED CONTROL PORT COMMANDS

The mem control port command reports memory usage statistics for each pool. This command displays memory usage both in terms of buffers and kilobytes for each pool. It can also report on number of buffers allocated and freed since the pool was defined. The latter usage helps to expose memory leaks.


SEE ALSO

UT_mem_free(3), UT_mem_pool_create(3)


AUTHOR

Troy D. Hanson <thanson@users.sourceforge.net>