IceShard 1
A personal game engine project, with development focused on 2D/2.5D games.
Loading...
Searching...
No Matches
mem_allocator_ring.hxx
Go to the documentation of this file.
1
3
4#pragma once
6
7namespace ice
8{
9
15
17 {
19 ice::Allocator& backing_allocator,
20 ice::RingAllocatorParams params = { },
21 std::source_location = std::source_location::current()
22 ) noexcept;
23
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
SPDX-License-Identifier: MIT.
Definition array.hxx:12
ice::AllocatorBase< ice::build::is_debug||ice::build::is_develop > Allocator
Definition mem_types.hxx:25
Definition mem.hxx:16
Definition mem.hxx:44
void reset() noexcept
Releases all memory blocks not in-use.
RingAllocator(ice::Allocator &backing_allocator, std::string_view name, ice::RingAllocatorParams params={ }, std::source_location=std::source_location::current()) noexcept
bool is_backed(void *ptr) const noexcept
RingAllocator(ice::Allocator &backing_allocator, ice::RingAllocatorParams params={ }, std::source_location=std::source_location::current()) noexcept
auto do_allocate(ice::AllocRequest request) noexcept -> ice::AllocResult override
bool is_locked(void *ptr) const noexcept
~RingAllocator() noexcept
void do_deallocate(void *pointer) noexcept override
Definition mem_allocator_ring.hxx:11
ice::usize ring_buffer_size
The size of the ring buffer.
Definition mem_allocator_ring.hxx:13
Represents a unsigned size value on the given platform.
Definition mem_size_types.hxx:26