1#ifndef BASE_CORE_ALLOCATOR_H_
2#define BASE_CORE_ALLOCATOR_H_
36 virtual void*
allocate(
size_t size,
size_t alignment) = 0;
43 virtual void free(
void* ptr) = 0;
An abstract base class for memory allocators.
Definition allocator.h:17
virtual container::DeviceType GetDeviceType()=0
Get the type of memory used by the TensorBuffer.
size_t allocated_size_
The total number of bytes allocated by this allocator.
Definition allocator.h:68
virtual void * allocate(size_t size, size_t alignment)=0
Allocate a block of memory with the given size and alignment.
virtual size_t AllocatedSize(void *ptr)
Get the allocated size of a given pointer.
Definition allocator.h:51
virtual ~Allocator()=default
virtual void * allocate(size_t size)=0
Allocate a block of memory with the given size and default alignment.
virtual void free(void *ptr)=0
Free a block of memory that was previously allocated by this allocator.
DeviceType
The type of memory used by an allocator.
Definition tensor_types.h:73
This file contains the definition of the DataType enum class.