IceShard
1
A personal game engine project, with development focused on 2D/2.5D games.
Toggle main menu visibility
Loading...
Searching...
No Matches
memsys
public
ice
mem_allocator_forward.hxx
Go to the documentation of this file.
1
3
4
#pragma once
5
#include <
ice/mem_allocator.hxx
>
6
7
namespace
ice
8
{
9
10
struct
ForwardAllocatorParams
11
{
13
ice::usize
bucket_size
= 1_KiB;
14
16
ice::u32
min_bucket_count
= 1;
17
};
18
19
struct
ForwardAllocator
:
public
ice::Allocator
20
{
21
ForwardAllocator
(
22
ice::Allocator
& backing_allocator,
23
ice::ForwardAllocatorParams
params = { },
24
std::source_location = std::source_location::current()
25
)
noexcept
;
26
27
ForwardAllocator
(
28
ice::Allocator
& backing_allocator,
29
std::string_view name,
30
ice::ForwardAllocatorParams
params = { },
31
std::source_location = std::source_location::current()
32
)
noexcept
;
33
34
~ForwardAllocator
() noexcept;
35
37
void
reset
() noexcept;
38
39
protected:
40
struct MemoryBucket;
41
42
auto
do_allocate
(
ice
::
AllocRequest
request) noexcept ->
ice
::
AllocResult
override;
43
void
do_deallocate
(
void
* pointer) noexcept override;
44
45
private:
46
ice
::
Allocator
& _backing_alloc;
47
ice
::
ForwardAllocatorParams
const _params;
48
49
MemoryBucket* _buckets;
50
};
51
52
}
// namespace ice
mem_allocator.hxx
ice
SPDX-License-Identifier: MIT.
Definition
array.hxx:12
ice::u32
std::uint32_t u32
Definition
types.hxx:26
ice::Allocator
ice::AllocatorBase< ice::build::is_debug||ice::build::is_develop > Allocator
Definition
mem_types.hxx:25
ice::AllocRequest
Definition
mem.hxx:16
ice::AllocResult
Definition
mem.hxx:44
ice::ForwardAllocator::ForwardAllocator
ForwardAllocator(ice::Allocator &backing_allocator, std::string_view name, ice::ForwardAllocatorParams params={ }, std::source_location=std::source_location::current()) noexcept
ice::ForwardAllocator::do_deallocate
void do_deallocate(void *pointer) noexcept override
ice::ForwardAllocator::ForwardAllocator
ForwardAllocator(ice::Allocator &backing_allocator, ice::ForwardAllocatorParams params={ }, std::source_location=std::source_location::current()) noexcept
ice::ForwardAllocator::reset
void reset() noexcept
Releases all memory blocks not in-use.
ice::ForwardAllocator::do_allocate
auto do_allocate(ice::AllocRequest request) noexcept -> ice::AllocResult override
ice::ForwardAllocator::~ForwardAllocator
~ForwardAllocator() noexcept
ice::ForwardAllocatorParams
Definition
mem_allocator_forward.hxx:11
ice::ForwardAllocatorParams::bucket_size
ice::usize bucket_size
The size of a single memory block.
Definition
mem_allocator_forward.hxx:13
ice::ForwardAllocatorParams::min_bucket_count
ice::u32 min_bucket_count
The number of empty buckets allocated.
Definition
mem_allocator_forward.hxx:16
ice::usize
Represents a unsigned size value on the given platform.
Definition
mem_size_types.hxx:26
Generated by
1.18.0