nngn
|
Tracks state allocations. More...
#include <alloc.h>
Classes | |
struct | info |
Allocation information for each type. More... | |
Static Public Member Functions | |
static void * | lua_alloc (void *d, void *p, std::size_t s0, std::size_t s1) |
Function to be passed to lua_newstate . | |
Public Attributes | |
std::array< info, n_types > | v = {} |
Total size in bytes of active allocations for each type. | |
Static Public Attributes | |
static constexpr std::array | types |
Each entry corresponds to the allocation information in v. | |
static constexpr auto | n_types = 1 + std::tuple_size_v< > |
Number of types for which allocations are tracked. | |
Tracks state allocations.
Allocations are tracked for each of the types described in the lua_Alloc
documentation (parameter osize
), corresponding to the elements of the static array types. Each position in the array v contains the allocation information for the corresponding type in types. One extra position at the end (i.e. at position types.size()
) holds information for "other" types.
lua_alloc is a static function which can serve as lua_Alloc
allocator. Its d
parameter should be the address of an object of this type. malloc(3)
, realloc(3)
, and free(3)
will be used for actual memory allocations.
|
static |
Function to be passed to lua_newstate
.
|
staticconstexpr |
Number of types for which allocations are tracked.
One extra position for "other".
|
staticconstexpr |
Each entry corresponds to the allocation information in v.
Total size in bytes of active allocations for each type.
Types are in the same order as types.