Embedded Multicore Building Blocks V1.0.0
Static Public Member Functions | List of all members
embb::base::CacheAlignedAllocatable Class Reference

Overloaded new/delete operators. More...

#include <memory_allocation.h>

Static Public Member Functions

static void * operator new (size_t size)
 New operator. More...
 
static void operator delete (void *ptr, size_t size)
 Delete operator. More...
 
static void * operator new[] (size_t size)
 Array new operator. More...
 
static void operator delete[] (void *ptr, size_t size)
 Array delete operator. More...
 

Detailed Description

Overloaded new/delete operators.

Classes that derive from this class will use the EMBB methods for dynamic, cache-aligned allocation and deallocation of memory (Allocation::AllocateCacheAligned() and Allocation::FreeAligned()). In debug mode, memory consumption is tracked in order to detect memory leaks.

Note
When using the new[] operator, not each object in the array is aligned, but only the constructed array as a whole.
See also
Allocatable

Member Function Documentation

static void* embb::base::CacheAlignedAllocatable::operator new ( size_t  size)
static

New operator.

Allocates size bytes of memory. Must not be called directly!

Returns
Pointer to allocated block of memory
Exceptions
embb::base::NoMemoryExceptionif not enough memory is available.
Concurrency
Thread-safe
Dynamic memory allocation
See Allocation::AllocateCacheAligned()
See also
operator delete()
Parameters
[in]sizeSize of the memory block in bytes
static void embb::base::CacheAlignedAllocatable::operator delete ( void *  ptr,
size_t  size 
)
static

Delete operator.

Deletes size bytes of memory pointed to by ptr. Must not be called directly!

Concurrency
Thread-safe
Parameters
[in,out]ptrPointer to memory block to be freed
[in]sizeSize of the memory block in bytes
static void* embb::base::CacheAlignedAllocatable::operator new[] ( size_t  size)
static

Array new operator.

Allocates an array of size bytes. Must not be called directly!

Returns
Pointer to allocated block of memory
Exceptions
embb::base::NoMemoryExceptionif not enough memory is available.
Dynamic memory allocation
See Allocation::AllocateCacheAligned()
Concurrency
Thread-safe
See also
operator delete[]()
Parameters
[in]sizesize of bytes to allocate for the array
static void embb::base::CacheAlignedAllocatable::operator delete[] ( void *  ptr,
size_t  size 
)
static

Array delete operator.

Deletes array of size bytes pointed to by ptr. Must not be called directly!

Concurrency
Thread-safe
See also
operator new[]()
Parameters
[in,out]ptrPointer to the array to be freed
[in]sizeSize of the array in bytes