The Allocator interface class supports allocating and releasing memory dynamically and querying the amount of extra memory used in the integrating application. More...
Public Member Functions | |
virtual void * | malloc (Size size)=0 |
Allocates a memory block of the given size. More... |
|
virtual void | free (void *memory)=0 |
Releases the given memory block. More... |
|
virtual Size | get_used_extra_memory ()=0 |
This function is used by Iray to inquire the amount of extra memory currently in use in the application. More... |
|
Additional Inherited Members | |
Public Types inherited from mi::base::Interface_declare< 0x952af060, 0xe2a6, 0x4bd7, 0xa2, 0x52, 0x9f, 0x6d, 0x39, 0xfb, 0x50, 0xa3, base::IAllocator > | |
typedef Interface_declare< id1, id2, id3, id4, id5, id6, id7, id8, id9, id10, id11, base::IAllocator > |
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... |
|
Static Public Member Functions inherited from mi::base::Interface_declare< 0x952af060, 0xe2a6, 0x4bd7, 0xa2, 0x52, 0x9f, 0x6d, 0x39, 0xfb, 0x50, 0xa3, base::IAllocator > | |
static bool | compare_iid (const Uuid &iid) |
Compares the interface ID iid against the interface ID of this interface and of its ancestors. More... |
|
The Allocator interface class supports allocating and releasing memory dynamically and querying the amount of extra memory used in the integrating application.
You can provide your own allocator object implementing this interface at initialization time of the Iray library to have the Iray API use your memory management.
|
pure virtual |
Releases the given memory block.
This function can be called at any time from any thread, including concurrent calls from several threads at the same time.
memory | A memory block previously allocated by a call to malloc(). If memory is NULL , no operation is performed. |
Implements mi::base::IAllocator.
|
pure virtual |
This function is used by Iray to inquire the amount of extra memory currently in use in the application.
This function may be called frequently and must be implemented efficiently.
This function can be called at any time from any thread, including concurrent calls from several threads at the same time.
|
pure virtual |
Allocates a memory block of the given size.
The memory must be aligned to an address which can accommodate any type of object on the current platform.
An allocation of zero bytes returns a valid non- NULL
pointer which must be freed in the end. However, dereferencing this pointer gives undefined behavior.
This function can be called at any time from any thread, including concurrent calls from several threads at the same time.
If the requested memory is not available this function must return NULL
. In this case Iray will try to reduce the memory it uses and retry the allocation. If allocation still fails Iray will give up. In this case Iray can not be used anymore and must be shut down. Iray will try to release as much memory as possible but it can not be guaranteed that all memory is returned. It is not possible to restart the library after a failure without restarting the process.
Plugins for the Iray API will get an allocator implementation that uses Iray memory management to give the stronger guarantee that allocation can never fail.
size | The requested size of memory in bytes. It may be zero. |
Implements mi::base::IAllocator.