Divide Framework
0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
LinearAllocator.h
Go to the documentation of this file.
1
/*
2
Author : Tobias Stein
3
Date : 22nd October, 2016
4
File : LinearAllocator.h
5
6
Linear allocator.
7
8
All Rights Reserved. (c) Copyright 2016.
9
*/
10
11
#pragma once
12
#ifndef ECS__LINEAR_ALLOC_H__
13
#define ECS__LINEAR_ALLOC_H__
14
15
#include "
Memory/Allocator/IAllocator.h
"
16
17
namespace
ECS
{
namespace
Memory {
namespace
Allocator {
18
19
/*
20
Allocates memory in a linear way.
21
22
first 2 3 4
23
allocatation alloaction
24
v v v v
25
|=================|=====|==|======| .... |
26
^ ^
27
Initialial Last possible
28
memory memory address
29
address (mem + memSize)
30
(mem)
31
32
33
memory only can be freed by clearing all allocations
34
*/
35
class
ECS_API
LinearAllocator
:
public
IAllocator
36
{
37
public
:
38
39
LinearAllocator
(
size_t
memSize,
const
void
* mem);
40
41
virtual
~LinearAllocator
();
42
43
virtual
void
* allocate(
size_t
size,
u8
alignment)
override
;
44
virtual
void
free(
void
* p)
override
;
45
virtual
void
clear()
override
;
46
47
};
// class LineaerAllocator
48
49
} } }
// namespace ECS::Memory::Allocator
50
51
#endif
// ECS__LINEAR_ALLOC_H__
IAllocator.h
ECS_API
#define ECS_API
Definition:
Platform.h:16
ECS::Memory::Allocator::IAllocator
Definition:
IAllocator.h:56
ECS::Memory::Allocator::LinearAllocator
Definition:
LinearAllocator.h:36
ECS
Definition:
SGNComponent.h:51
ECS::u8
uint8_t u8
Definition:
Platform.h:49
Source
ThirdParty
EntityComponentSystem
include
ECS
Memory
Allocator
LinearAllocator.h
Generated on Fri May 17 2024 16:59:57 for Divide Framework by
1.9.6