Max OS 0.3
Loading...
Searching...
No Matches
MaxOS::memory::allocator::MemoryAllocator Class Reference

Generic memory allocator type. More...

#include <allocator.h>

Inheritance diagram for MaxOS::memory::allocator::MemoryAllocator:
MaxOS::memory::allocator::BumpAllocator MaxOS::memory::BumpMemoryManager MaxOS::processes::resources::BridgeHandler MaxOS::memory::MemoryManager

Public Member Functions

 MemoryAllocator ()
 
virtual ~MemoryAllocator ()
 
virtual void setup_region (uintptr_t address, size_t length)
 Setup a region to be bump memory managed.
 
virtual void * allocate (size_t size)
 Allocates a block of memory.
 
virtual void unallocate (void *pointer)
 Frees a block of memory.
 
virtual size_t amount_used ()
 Returns the amount of memory used (btyes)
 
virtual size_t align (size_t size)
 Aligns the size to the chunk alignment.
 

Detailed Description

Generic memory allocator type.

Definition at line 23 of file allocator.h.

Constructor & Destructor Documentation

◆ MemoryAllocator()

MemoryAllocator::MemoryAllocator ( )
default

Default constructor for a generic memory allocator

◆ ~MemoryAllocator()

MemoryAllocator::~MemoryAllocator ( )
virtualdefault

Default destructor for a generic memory allocator

Member Function Documentation

◆ align()

size_t MemoryAllocator::align ( size_t  size)
virtual

Aligns the size to the chunk alignment.

Parameters
sizeThe size to align
Returns
The aligned size

Reimplemented in MaxOS::memory::allocator::BumpAllocator.

Definition at line 84 of file allocator.cpp.

84 {
85 return 0;
86}

◆ allocate()

void * MemoryAllocator::allocate ( size_t  size)
virtual

Allocates a block of memory.

Parameters
sizeThe size of the block to allocate
Returns
A pointer to the block, or nullptr if no block is available

Reimplemented in MaxOS::memory::allocator::BumpAllocator.

Definition at line 57 of file allocator.cpp.

57 {
58 return nullptr;
59}

◆ amount_used()

size_t MemoryAllocator::amount_used ( )
virtual

Returns the amount of memory used (btyes)

Returns
The amount of memory used

Reimplemented in MaxOS::memory::allocator::BumpAllocator.

Definition at line 74 of file allocator.cpp.

74 {
75 return 0;
76}

◆ setup_region()

void MemoryAllocator::setup_region ( uintptr_t  address,
size_t  length 
)
virtual

Setup a region to be bump memory managed.

Parameters
addressThe start of the region
lengthThe length of the region

Reimplemented in MaxOS::memory::allocator::BumpAllocator.

Definition at line 48 of file allocator.cpp.

48 {
49}

◆ unallocate()

void MemoryAllocator::unallocate ( void *  pointer)
virtual

Frees a block of memory.

Parameters
pointerA pointer to the block to free

Reimplemented in MaxOS::memory::allocator::BumpAllocator.

Definition at line 66 of file allocator.cpp.

66 {
67}

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