6#include <source_location>
12 template<
bool WithDebugInfo>
21 AllocatorBase(std::source_location
const&, std::string_view)
noexcept { }
33 request.finalize(result);
37 template<
typename T>
requires std::is_trivial_v<T>
45 if (pointer ==
nullptr)
return;
54 template<
typename T,
typename... Args>
55 auto create(Args&&... args)
noexcept -> T*
58 return new (mem.
memory) T{ ice::forward<Args>(args)... };
109 std::source_location src_loc,
110 std::string_view
name
114 std::source_location
const& src_loc,
115 std::string_view
name,
121 auto
location() const noexcept -> std::source_location
126 auto name() const noexcept -> std::string_view
187 template<
typename T>
requires std::is_trivial_v<T>
196 if (memory.location ==
nullptr)
return;
200 template<
typename T,
typename... Args>
201 auto create(Args&&... args)
noexcept -> T*
204 return new (mem.
memory) T{ ice::forward<Args>(args)... };
207 template<
typename T>
requires (std::is_const_v<T> ==
false)
Definition mem_allocator.hxx:106
std::string_view const _name
Definition mem_allocator.hxx:158
auto next_sibling() const noexcept -> ice::AllocatorDebugInfo const *
auto allocation_count() const noexcept -> ice::u32
Definition mem_allocator.hxx:131
std::atomic< ice::u32 > _alloc_count
Definition mem_allocator.hxx:165
void dbg_count_add() noexcept
ice::AllocatorDebugInfo * _next_sibling
Definition mem_allocator.hxx:162
void dbg_count_sub() noexcept
auto allocation_size_inuse() const noexcept -> ice::usize
Internal * _internal
Definition mem_allocator.hxx:169
ice::AllocatorDebugInfo * _prev_sibling
Definition mem_allocator.hxx:163
std::atomic< ice::u32 > _alloc_total_count
Definition mem_allocator.hxx:166
auto name() const noexcept -> std::string_view
Definition mem_allocator.hxx:126
void remove_child(ice::AllocatorDebugInfo *child_allocator) noexcept
void track_child(ice::AllocatorDebugInfo *child_allocator) noexcept
auto child_allocator() const noexcept -> ice::AllocatorDebugInfo const *
auto parent_allocator() const noexcept -> ice::AllocatorDebugInfo const *
ice::AllocatorDebugInfo * _children
Definition mem_allocator.hxx:161
AllocatorDebugInfo(std::source_location const &src_loc, std::string_view name, ice::AllocatorDebugInfo &parent) noexcept
AllocatorDebugInfo(std::source_location src_loc, std::string_view name) noexcept
auto allocation_total_count() const noexcept -> ice::u32
Definition mem_allocator.hxx:136
auto location() const noexcept -> std::source_location
Definition mem_allocator.hxx:121
std::source_location const _source_location
Definition mem_allocator.hxx:157
virtual ~AllocatorDebugInfo() noexcept
auto allocation_size_watermark() const noexcept -> ice::usize
ice::AllocatorDebugInfo *const _parent
Definition mem_allocator.hxx:160
SPDX-License-Identifier: MIT.
Definition array.hxx:12
std::uint64_t u64
Definition types.hxx:27
constexpr auto count(T const (&)[Size]) noexcept -> ice::u32
Definition base.hxx:43
std::uint32_t u32
Definition types.hxx:26
constexpr ice::meminfo meminfo_of
Definition mem_info.hxx:18
void * memory
Definition mem.hxx:45
static constexpr ice::usize SizeNotTracked
Definition mem_allocator.hxx:175
AllocatorBase(std::source_location const &src_loc, AllocatorBase &parent) noexcept
auto allocate(ice::AllocRequest request) noexcept -> ice::AllocResult
auto create(Args &&... args) noexcept -> T *
Definition mem_allocator.hxx:201
virtual auto do_allocate(ice::AllocRequest request) noexcept -> ice::AllocResult=0
void destroy(T *object) noexcept
Definition mem_allocator.hxx:208
auto allocate(ice::u64 count=1) noexcept -> T *
Definition mem_allocator.hxx:188
AllocatorBase(std::source_location const &src_loc, std::string_view name) noexcept
static constexpr bool HasDebugInformation
Definition mem_allocator.hxx:177
AllocatorBase(std::source_location const &src_loc) noexcept
auto debug_info() const noexcept -> ice::AllocatorDebugInfo const &
\copy AllocatorBase<false>::debug_info()
virtual void do_deallocate(void *pointer) noexcept=0
auto allocate(ice::ChunkedAllocRequest const &request) noexcept -> ice::AllocResult
void deallocate(ice::Memory memory) noexcept
Definition mem_allocator.hxx:194
void deallocate(void *pointer) noexcept
virtual auto allocation_size(void *ptr) const noexcept -> ice::usize
Definition mem_allocator.hxx:218
static constexpr ice::u32 CountNotTracked
Definition mem_allocator.hxx:176
AllocatorBase(std::source_location const &src_loc, AllocatorBase &parent, std::string_view name) noexcept
auto allocation_size_inuse() const noexcept -> ice::usize
Definition mem_allocator.hxx:78
void destroy(T *object) noexcept
Definition mem_allocator.hxx:62
auto allocate(ice::u64 count=1) noexcept -> T *
Definition mem_allocator.hxx:38
AllocatorBase(std::source_location const &, std::string_view) noexcept
Definition mem_allocator.hxx:21
auto allocation_count() const noexcept -> ice::u32
Definition mem_allocator.hxx:68
void deallocate(void *pointer) noexcept
Definition mem_allocator.hxx:43
AllocatorBase(std::source_location const &, AllocatorBase &) noexcept
Definition mem_allocator.hxx:22
static constexpr ice::u32 CountNotTracked
Definition mem_allocator.hxx:16
virtual void do_deallocate(void *pointer) noexcept=0
auto allocate(ice::ChunkedAllocRequest const &request) noexcept -> ice::AllocResult
Definition mem_allocator.hxx:30
AllocatorBase(std::source_location const &, AllocatorBase &, std::string_view) noexcept
Definition mem_allocator.hxx:23
AllocatorBase(std::source_location const &) noexcept
Definition mem_allocator.hxx:20
auto create(Args &&... args) noexcept -> T *
Definition mem_allocator.hxx:55
auto allocation_total_count() const noexcept -> ice::u32
Definition mem_allocator.hxx:73
static constexpr ice::usize SizeNotTracked
Definition mem_allocator.hxx:15
void deallocate(ice::Memory result) noexcept
Definition mem_allocator.hxx:49
auto allocation_size_watermark() const noexcept -> ice::usize
Definition mem_allocator.hxx:83
virtual auto allocation_size(void *ptr) const noexcept -> ice::usize
Definition mem_allocator.hxx:88
static constexpr bool HasDebugInformation
Definition mem_allocator.hxx:18
virtual auto do_allocate(ice::AllocRequest request) noexcept -> ice::AllocResult=0
auto debug_info() const noexcept -> ice::AllocatorDebugInfo const &
Gives access to debug information for an allocator.
auto allocate(ice::AllocRequest request) noexcept -> ice::AllocResult
Definition mem_allocator.hxx:25
Definition mem_memory.hxx:13
Represents a unsigned size value on the given platform.
Definition mem_size_types.hxx:26
std::size_t base_type
Definition mem_size_types.hxx:28