Memory operations are indirected through function pointers. The
AL_Allocator default implementation simply wraps malloc and free,
etc.
Two higher level techniques are used for memory management: reference
counted buffers and buffer pools. A reference counted buffer is created with a
zero-reference count. The AL_Buffer_Ref and
AL_Buffer_Unref functions increment and decrement the reference
count, respectively. The AL_Buffer interface separates the management
of buffer metadata from the management of the data memory associated with the buffer.
Usage of the reference count is optional.
The AL_TBufPool implementation manages a buffer pool with
a ring buffer. Some ring buffers have there sizes fixed at compile time. Exceeding the
buffer pool size results in undefined behavior. See
AL_Decoder_PutDisplayPicture.