mutable
A Database System for Research and Fast Prototyping
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Attributes | Friends
m::memory::Allocator Struct Referenceabstract

This is the common interface for all memory allocators that support rewiring. More...

#include <memory.hpp>

Inheritance diagram for m::memory::Allocator:
[legend]
Collaboration diagram for m::memory::Allocator:
[legend]

Public Member Functions

 Allocator ()
 
virtual ~Allocator ()
 
int fd () const
 Return the file descriptor of the underlying memory file.
 
virtual Memory allocate (std::size_t size)=0
 Creates a new memory object with size bytes of freshly allocated memory.
 

Protected Member Functions

virtual void deallocate (Memory &&mem)=0
 Deallocates a memory object.
 
Memory create_memory (void *addr, std::size_t size, std::size_t offset)
 Helper method to inherit the friend ability to construct a Memory object.
 

Private Attributes

int fd_
 file descriptor of the underlying memory file
 

Friends

struct Memory
 

Detailed Description

This is the common interface for all memory allocators that support rewiring.


Definition at line 17 of file memory.hpp.

Constructor & Destructor Documentation

◆ Allocator()

Allocator::Allocator ( )

Definition at line 31 of file memory.cpp.

References fd_.

◆ ~Allocator()

Allocator::~Allocator ( )
virtual

Definition at line 45 of file memory.cpp.

References fd_.

Member Function Documentation

◆ allocate()

virtual Memory m::memory::Allocator::allocate ( std::size_t  size)
pure virtual

Creates a new memory object with size bytes of freshly allocated memory.

Implemented in m::memory::LinearAllocator.

Referenced by m::wasm::Module::Memory().

◆ create_memory()

Memory Allocator::create_memory ( void *  addr,
std::size_t  size,
std::size_t  offset 
)
protected

Helper method to inherit the friend ability to construct a Memory object.

Definition at line 50 of file memory.cpp.

References Memory.

Referenced by m::memory::LinearAllocator::allocate().

◆ deallocate()

virtual void m::memory::Allocator::deallocate ( Memory &&  mem)
protectedpure virtual

Deallocates a memory object.

Implemented in m::memory::LinearAllocator.

◆ fd()

int m::memory::Allocator::fd ( ) const
inline

Return the file descriptor of the underlying memory file.

Definition at line 29 of file memory.hpp.

Referenced by m::memory::LinearAllocator::allocate(), m::memory::LinearAllocator::deallocate(), and m::memory::Memory::dump().

Friends And Related Function Documentation

◆ Memory

friend struct Memory
friend

Definition at line 19 of file memory.hpp.

Referenced by m::memory::LinearAllocator::allocate(), and create_memory().

Field Documentation

◆ fd_

int m::memory::Allocator::fd_
private

file descriptor of the underlying memory file

Definition at line 22 of file memory.hpp.

Referenced by Allocator(), and ~Allocator().


The documentation for this struct was generated from the following files: