1 #ifndef MF_UTILITY_MEMORY_H_
2 #define MF_UTILITY_MEMORY_H_
19 std::size_t remaining = page_capacity - (n % page_capacity);
25 return round_up_to_fit_system_page_size<byte>(len);
41 void*
raw_allocate(std::size_t size, std::size_t align = 1);
52 void*
raw_allocate(std::size_t size, std::size_t align = 1);
63 void*
raw_allocate(std::size_t size, std::size_t align = 1);
std::size_t raw_round_up_to_fit_system_page_size(std::size_t len)
Round number of bytes len up to a multiple of the system page size.
Definition: memory.h:24
void raw_deallocate(void *ptr, std::size_t size)
void * raw_allocate(std::size_t size, std::size_t align=1)
memory_usage_advice
Definition: memory.h:28
Ring allocator, allocates ring buffer memory.
Definition: memory.h:50
void * raw_allocate(std::size_t size, std::size_t align=1)
void raw_deallocate(void *ptr, std::size_t size)
#define MF_EXPECTS(condition)
Definition: common.h:27
Raw allocator, allocates given number of bytes.
Definition: memory.h:39
void raw_deallocate(void *ptr, std::size_t size)
void set_memory_usage_advice(void *ptr, std::size_t, memory_usage_advice)
Provide hint to operating system on how memory at ptr will be accessed.
std::size_t system_page_size()
Get page size of operating system, in bytes.
std::size_t round_up_to_fit_system_page_size(std::size_t n)
Round n up so that T[n] has a size that is a multiple of the system page size.
Definition: memory.h:16
void * raw_allocate(std::size_t size, std::size_t align=1)
Null allocator, allocates virtual memory which is not used.
Definition: memory.h:61