The memory management provides an interface for allocators. More...
Classes | |
| class | mi::base::IAllocator |
| The IAllocator interface class supports allocating and releasing memory dynamically. More... | |
Functions | |
| virtual void * | mi::base::IAllocator::malloc (Size size)=0 |
| Allocates a memory block of the given size. More... | |
| virtual void | mi::base::IAllocator::free (void *memory)=0 |
| Releases the given memory block. More... | |
The memory management provides an interface for allocators.
You can request dynamic memory from an allocator implementation through an mi::base::IAllocator interface.
|
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 nullptr, no operation is performed. |
Implemented in mi::neuraylib::IAllocator.
|
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 returns nullptr. Some products give the stronger guarantee that allocation can never fail. (They can do this, for example, by flushing parts or in its extreme, stop executing.) See the API documentation of the specific products for specific allocator interfaces or allocator documentation.
| size | The requested size of memory in bytes. It may be zero. |
Implemented in mi::neuraylib::IAllocator.