Max OS 0.3
Loading...
Searching...
No Matches
allocator.h
Go to the documentation of this file.
1
11#ifndef MAXOS_MEMORY_ALLOCATOR_H
12#define MAXOS_MEMORY_ALLOCATOR_H
13
14#include <cstddef>
15#include <cstdint>
16
17namespace MaxOS::memory::allocator {
18
24
25 private:
26
27 virtual void* expand_heap(size_t size);
28 virtual void* allocate_extra_space(size_t requested_size, size_t& actual_size);
29
30 public:
33
34 virtual void setup_region(uintptr_t address, size_t length);
35
36 virtual void* allocate(size_t size);
37 virtual void unallocate(void* pointer);
38
39 virtual size_t amount_used();
40 virtual size_t align(size_t size);
41
42 };
43
44}
45
46#endif //MAXOS_MEMORY_ALLOCATOR_H
Generic memory allocator type.
Definition allocator.h:23
virtual size_t amount_used()
Returns the amount of memory used (btyes)
Definition allocator.cpp:74
virtual void setup_region(uintptr_t address, size_t length)
Setup a region to be bump memory managed.
Definition allocator.cpp:48
virtual void unallocate(void *pointer)
Frees a block of memory.
Definition allocator.cpp:66
virtual void * allocate(size_t size)
Allocates a block of memory.
Definition allocator.cpp:57
virtual size_t align(size_t size)
Aligns the size to the chunk alignment.
Definition allocator.cpp:84