neuray API Programmer's Manual

mi::base::Default_allocator Class Reference

[Memory Management]

Description

A default allocator implementation based on global new and delete. This implementation realizes the singleton pattern. An instance of the default allocator can be obtained through the static inline method mi::base::Default_allocator::get_instance().

Include File:

#include <mi/base/default_allocator.h>

Public Member Functions

virtual void free( void* memory)
Releases the given memory block. More...
virtual void* malloc( Size size)
Allocates a memory block of the given size. More...

Static Public Member Functions

static IAllocatorget_instance()
Returns the single instance of the default allocator.

Member Functions

virtual void mi::​base::​Default_allocator::free( void* memory) [inline, virtual]

Releases the given memory block. Implements mi::base::IAllocator::free through a global operator delete call.

Parameters

memory
A memory block previously allocated by a call to malloc(). If memory is NULL, no operation is performed.
static IAllocator* mi::​base::​Default_allocator::get_instance() [inline, static]

Returns the single instance of the default allocator.

virtual void* mi::​base::​Default_allocator::malloc( Size size) [inline, virtual]

Allocates a memory block of the given size. Implements mi::base::IAllocator::malloc through a global non-throwing operator new call.

Parameters

size
The requested size of memory in bytes. It may be zero.

Returns

The allocated memory block.