NVIDIA Iray API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mi::base::Default_allocator Class Reference

A default allocator implementation based on global new and delete. More...

Inheritance diagram for mi::base::Default_allocator:
Inheritance graph
[legend]

Public Member Functions

virtual void *  malloc (Size size)
  Allocates a memory block of the given size. More...
 
virtual void  free (void *memory)
  Releases the given memory block. More...
 
- Public Member Functions inherited from mi::base::Interface_implement_singleton< IAllocator >
virtual Uint32  retain () const
  Returns the fixed reference count of one. More...
 
virtual Uint32  release () const
  Returns the fixed reference count of one. More...
 
virtual const IInterface get_interface (const Uuid &interface_id) const
  Acquires a const interface. More...
 
virtual IInterface get_interface (const Uuid &interface_id)
  Acquires a mutable interface. More...
 
Uuid  get_iid () const
  Returns the interface ID of the most derived interface. More...
 

Static Public Member Functions

static IAllocator get_instance ()
  Returns the single instance of the default allocator. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0xa1836db8, 0x6f63, 0x4079, 0x82, 0x82, 0xb3, 0x5d, 0x17, 0x36, 0x96, 0xef >
typedef Interface_declare< id1,
id2, id3, id4, id5, id6, id7,
id8, id9, id10, id11,
IInterface
Self
  Own type. More...
 
typedef Uuid_t< id1, id2, id3,
id4, id5, id6, id7, id8, id9,
id10, id11 > 
IID
  Declares the interface ID (IID) of this interface. More...
 

Detailed 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>

Member Function Documentation

virtual void mi::base::Default_allocator::free ( void *  memory)
inlinevirtual

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.

Implements mi::base::IAllocator.

static IAllocator* mi::base::Default_allocator::get_instance ( )
inlinestatic

Returns the single instance of the default allocator.

virtual void* mi::base::Default_allocator::malloc ( Size  size)
inlinevirtual

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.

Implements mi::base::IAllocator.