SyTen
syten::MemoryUsage Namespace Reference

Memory usage reporting with allocSize(), totalSize() and stackSize() More...

Classes

struct  AllocSize
 AllocSize default implementation: Returns zero always. More...
 
struct  AllocSize< std::array< T, num >, MemorySize >
 AllocSize() specialisation for std::array. More...
 
struct  AllocSize< std::map< Key, Value >, MemorySize >
 AllocSize() specialisation for std::map. More...
 
struct  AllocSize< std::pair< T, U >, MemorySize >
 AllocSize() specialisation for std::pair. More...
 
struct  AllocSize< std::string, MemorySize >
 AllocSize() specialisation for std::string. More...
 
struct  AllocSize< std::unordered_map< Key, Value >, MemorySize >
 AllocSize() specialisation for std::map. More...
 
struct  AllocSize< std::variant< Types... >, MemorySize >
 AllocSize() specialisation for std::variant. More...
 
struct  AllocSize< std::vector< T >, MemorySize >
 AllocSize() specialisation for std::vector. More...
 
struct  AllocSize< T, decltype(std::declval< T >().allocSize())>
 AllocSize specialisation if the member function T::allocSize() exists. More...
 
struct  MemorySize
 A certain number of bytes, a simple wrapper around std::size_t. More...
 
struct  StackSize
 StackSize default implementation: Returns sizeof(T). More...
 
struct  StackSize< T, decltype(std::declval< T >().stackSize())>
 StackSize specialisation if the member function T::stackSize() exists. More...
 
struct  TotalSize
 TotalSize default implementation: Returns stackSize(obj) + allocSize(obj). More...
 
struct  TotalSize< T, decltype(std::declval< T >().totalSize())>
 TotalSize specialisation if the member function T::totalSize() exists. More...
 

Functions

template<typename T >
constexpr MemorySize allocSize (T const &obj)
 Returns the amount of memory dynamically allocated by obj and its children. More...
 
std::ostreamoperator<< (std::ostream &out, MemorySize value)
 Pretty-prints a MemorySize object. More...
 
template<typename T >
constexpr MemorySize stackSize (T const &obj)
 Returns the amount of stack memory required by obj and its members. More...
 
template<typename T >
constexpr MemorySize totalSize (T const &obj)
 Returns the amount of total memory required by obj and its members. More...
 

Detailed Description

Memory usage reporting with allocSize(), totalSize() and stackSize()