SyTen
le_malloc.cpp File Reference

Implementation for file inc/util/le_malloc.h. More...

#include <vector>
#include "inc/util/le_malloc.h"
#include "inc/util/l_malloc.h"
+ Include dependency graph for le_malloc.cpp:

Classes

struct  syten::EternalMalloc::Region
 Struct representing one region of the eternal malloc pool. More...
 

Namespaces

namespace  syten
 Syten namespace.
 
namespace  syten::EternalMalloc
 Implementation namespace for le_malloc() and le_free()
 

Functions

void syten::le_free (void *ptr)
 Frees the space of memory pointed to by ptr. More...
 
void * syten::le_malloc (std::size_t const size, std::size_t const alignment=64)
 Allocates a region of heap memory at least size bytes large, aligned to alignment boundary in a special pool designed for eternal small objects (e.g. reps). More...
 
template<typename T , typename U >
constexpr T syten::EternalMalloc::next_multiple (T const current, U const alignment)
 Casts current to the type of alignment and adds the difference to the next value at which U(current) % alignment is zero; i.e. if alignment is 64, it returns the smallest value greater than current which is divisible by 64. More...
 

Variables

static constexpr std::size_t syten::EternalMalloc::region_default_size {4ULL * 1024ULL * 1024ULL}
 Default region size (unless a single allocation wouldn't fit. More...
 
static std::vector< Region > & syten::EternalMalloc::regions = reinterpret_cast<std::vector<Region>&>(regions_buffer)
 regions is a reference to space allocated at regions_buffer, holds a vector of allocated regions. More...
 
static std::aligned_storage< sizeof(std::vector< Region >), alignof(std::vector< Region >)>::type syten::EternalMalloc::regions_buffer
 Space for the regions object (cf. More...
 
static std::size_t syten::EternalMalloc::regionsCounter
 cf. More...
 

Detailed Description

Implementation for file inc/util/le_malloc.h.