4#ifndef WPI_MEMORY_DETAIL_MEMORY_STACK_HPP_INCLUDED
5#define WPI_MEMORY_DETAIL_MEMORY_STACK_HPP_INCLUDED
28 : cur_(
static_cast<char*
>(
memory))
47 void bump(std::size_t offset)
noexcept
71 void*
allocate(
const char* end, std::size_t size, std::size_t alignment,
77 auto remaining = std::size_t(end - cur_);
78 auto offset =
align_offset(cur_ + fence_size, alignment);
79 if (fence_size + offset + size + fence_size > remaining)
107 char*
top() const noexcept
Definition memory_stack.hpp:22
~fixed_memory_stack() noexcept=default
fixed_memory_stack(fixed_memory_stack &&other) noexcept
Definition memory_stack.hpp:32
void unwind(char *top) noexcept
Definition memory_stack.hpp:100
void * allocate_unchecked(std::size_t size, std::size_t align_offset, std::size_t fence_size=debug_fence_size) noexcept
Definition memory_stack.hpp:87
fixed_memory_stack(void *memory) noexcept
Definition memory_stack.hpp:27
void bump(std::size_t offset) noexcept
Definition memory_stack.hpp:47
void bump(std::size_t offset, debug_magic m) noexcept
Definition memory_stack.hpp:53
void * allocate(const char *end, std::size_t size, std::size_t alignment, std::size_t fence_size=debug_fence_size) noexcept
Definition memory_stack.hpp:71
void * bump_return(std::size_t offset, debug_magic m=debug_magic::new_memory) noexcept
Definition memory_stack.hpp:60
char * top() const noexcept
Definition memory_stack.hpp:107
fixed_memory_stack() noexcept
Definition memory_stack.hpp:24
debug_magic
The magic values that are used for debug filling.
Definition debugging.hpp:23
@ freed_memory
Marks freed memory - "dead memory".
@ alignment_memory
Marks buffer memory used to ensure proper alignment.
@ fence_memory
Marks buffer memory used to protect against overflow - "fence memory".
@ new_memory
Marks allocated, but not yet used memory - "clean memory".
detail namespace with internal helper functions
Definition input_adapters.h:32
std::size_t align_offset(std::uintptr_t address, std::size_t alignment) noexcept
Definition align.hpp:26
void debug_fill(void *, std::size_t, debug_magic) noexcept
Definition debug_helpers.hpp:45
constexpr std::size_t debug_fence_size
Definition debug_helpers.hpp:22
Memory namespace.
Definition heap_allocator.hpp:20
Foonathan namespace.
Definition ntcore_cpp.h:26