interface InferenceEngine::IAllocator

Overview

Allocator concept to be used for memory management and is used as part of the Blob. More…

#include <ie_allocator.hpp>

template IAllocator: public std::enable_shared_from_this< IAllocator >
{
    // methods

    virtual void* lock(void* handle, LockOp op = LOCK_FOR_WRITE) = 0;
    virtual void unlock(void* handle) = 0;
    virtual void* alloc(size_t size) = 0;
    virtual bool free(void* handle) = 0;

protected:
};

Detailed Documentation

Allocator concept to be used for memory management and is used as part of the Blob.

Methods

virtual void* lock(void* handle, LockOp op = LOCK_FOR_WRITE) = 0

Maps handle to heap memory accessible by any memory manipulation routines.

Parameters:

handle

Handle to the allocated memory to be locked

op

Operation to lock memory for

Returns:

Generic pointer to memory

virtual void unlock(void* handle) = 0

Unmaps memory by handle with multiple sequential mappings of the same handle.

The multiple sequential mappings of the same handle are suppose to get the same result while there isn’t a ref counter supported.

Parameters:

handle

Handle to the locked memory to unlock

virtual void* alloc(size_t size) = 0

Allocates memory.

Parameters:

size

The size in bytes to allocate

Returns:

Handle to the allocated resource

virtual bool free(void* handle) = 0

Releases the handle and all associated memory resources which invalidates the handle.

Parameters:

handle

The handle to free

Returns:

false if handle cannot be released, otherwise - true.