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_ring.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
RingAllocatorParams
11
{
13
ice::usize
ring_buffer_size
= 4_KiB;
14
};
15
16
struct
RingAllocator
:
public
ice::Allocator
17
{
18
RingAllocator
(
19
ice::Allocator
& backing_allocator,
20
ice::RingAllocatorParams
params = { },
21
std::source_location = std::source_location::current()
22
)
noexcept
;
23
24
RingAllocator
(
25
ice::Allocator
& backing_allocator,
26
std::string_view name,
27
ice::RingAllocatorParams
params = { },
28
std::source_location = std::source_location::current()
29
)
noexcept
;
30
31
~RingAllocator
() noexcept;
32
34
void
reset
() noexcept;
35
36
protected:
37
struct MemoryBucket;
38
39
auto
do_allocate
(
ice
::
AllocRequest
request) noexcept ->
ice
::
AllocResult
override;
40
void
do_deallocate
(
void
* pointer) noexcept override;
41
42
bool
is_locked
(
void
* ptr) const noexcept;
43
bool
is_backed
(
void
* ptr) const noexcept;
44
45
private:
46
ice
::
Allocator
& _backing_alloc;
47
ice
::
RingAllocatorParams
const _params;
48
49
void
* _begin;
50
void
* _end;
51
52
void
* _allocate;
53
void
* _free;
54
};
55
56
}
// namespace ice
mem_allocator.hxx
ice
SPDX-License-Identifier: MIT.
Definition
array.hxx:12
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::RingAllocator::reset
void reset() noexcept
Releases all memory blocks not in-use.
ice::RingAllocator::RingAllocator
RingAllocator(ice::Allocator &backing_allocator, std::string_view name, ice::RingAllocatorParams params={ }, std::source_location=std::source_location::current()) noexcept
ice::RingAllocator::is_backed
bool is_backed(void *ptr) const noexcept
ice::RingAllocator::RingAllocator
RingAllocator(ice::Allocator &backing_allocator, ice::RingAllocatorParams params={ }, std::source_location=std::source_location::current()) noexcept
ice::RingAllocator::do_allocate
auto do_allocate(ice::AllocRequest request) noexcept -> ice::AllocResult override
ice::RingAllocator::is_locked
bool is_locked(void *ptr) const noexcept
ice::RingAllocator::~RingAllocator
~RingAllocator() noexcept
ice::RingAllocator::do_deallocate
void do_deallocate(void *pointer) noexcept override
ice::RingAllocatorParams
Definition
mem_allocator_ring.hxx:11
ice::RingAllocatorParams::ring_buffer_size
ice::usize ring_buffer_size
The size of the ring buffer.
Definition
mem_allocator_ring.hxx:13
ice::usize
Represents a unsigned size value on the given platform.
Definition
mem_size_types.hxx:26
Generated by
1.18.0