openDAQ
Open data acquisition platform
AllocatorPtr Class Reference

An allocator used to allocate memory. More...

Inherits ObjectPtr< IAllocator >.

Detailed Description

An allocator used to allocate memory.

The default BB allocator simply uses malloc, but the user can implement a custom allocator to override this behavior (perhaps using a memory pool or different allocation strategy). An example/reference implementation is provided which uses Microsoft mimalloc.

Public Member Functions

void * allocate (const daq::DataDescriptorPtr &descriptor, daq::SizeT bytes, daq::SizeT align) const
 Allocates a chunk of memory for a packet. More...
 
void free (void *address) const
 Releases a chunk of memory allocated by allocate(). More...