Bitcoin Core 28.99.0
P2P Digital Currency
Classes | Functions
memusage Namespace Reference

Classes

struct  list_node
 
struct  stl_shared_counter
 
struct  stl_tree_node
 
struct  unordered_node
 

Functions

static size_t MallocUsage (size_t alloc)
 Compute the total memory used by allocating alloc bytes. More...
 
static size_t DynamicUsage (const int8_t &v)
 Dynamic memory usage for built-in types is zero. More...
 
static size_t DynamicUsage (const uint8_t &v)
 
static size_t DynamicUsage (const int16_t &v)
 
static size_t DynamicUsage (const uint16_t &v)
 
static size_t DynamicUsage (const int32_t &v)
 
static size_t DynamicUsage (const uint32_t &v)
 
static size_t DynamicUsage (const int64_t &v)
 
static size_t DynamicUsage (const uint64_t &v)
 
static size_t DynamicUsage (const float &v)
 
static size_t DynamicUsage (const double &v)
 
template<typename X >
static size_t DynamicUsage (X *const &v)
 
template<typename X >
static size_t DynamicUsage (const X *const &v)
 
template<typename T , typename Allocator >
static size_t DynamicUsage (const std::vector< T, Allocator > &v)
 
static size_t DynamicUsage (const std::string &s)
 
template<unsigned int N, typename X , typename S , typename D >
static size_t DynamicUsage (const prevector< N, X, S, D > &v)
 
template<typename X , typename Y >
static size_t DynamicUsage (const std::set< X, Y > &s)
 
template<typename X , typename Y >
static size_t IncrementalDynamicUsage (const std::set< X, Y > &s)
 
template<typename X , typename Y , typename Z >
static size_t DynamicUsage (const std::map< X, Y, Z > &m)
 
template<typename X , typename Y , typename Z >
static size_t IncrementalDynamicUsage (const std::map< X, Y, Z > &m)
 
template<typename X , typename Y >
static size_t DynamicUsage (const indirectmap< X, Y > &m)
 
template<typename X , typename Y >
static size_t IncrementalDynamicUsage (const indirectmap< X, Y > &m)
 
template<typename X >
static size_t DynamicUsage (const std::unique_ptr< X > &p)
 
template<typename X >
static size_t DynamicUsage (const std::shared_ptr< X > &p)
 
template<typename X >
static size_t DynamicUsage (const std::list< X > &l)
 
template<typename X , typename Y >
static size_t DynamicUsage (const std::unordered_set< X, Y > &s)
 
template<typename X , typename Y , typename Z >
static size_t DynamicUsage (const std::unordered_map< X, Y, Z > &m)
 
template<class Key , class T , class Hash , class Pred , std::size_t MAX_BLOCK_SIZE_BYTES, std::size_t ALIGN_BYTES>
static size_t DynamicUsage (const std::unordered_map< Key, T, Hash, Pred, PoolAllocator< std::pair< const Key, T >, MAX_BLOCK_SIZE_BYTES, ALIGN_BYTES > > &m)
 

Function Documentation

◆ DynamicUsage() [1/24]

static size_t memusage::DynamicUsage ( const double &  v)
inlinestatic

Definition at line 40 of file memusage.h.

◆ DynamicUsage() [2/24]

static size_t memusage::DynamicUsage ( const float &  v)
inlinestatic

Definition at line 39 of file memusage.h.

◆ DynamicUsage() [3/24]

template<typename X , typename Y >
static size_t memusage::DynamicUsage ( const indirectmap< X, Y > &  m)
inlinestatic

Definition at line 139 of file memusage.h.

Here is the call graph for this function:

◆ DynamicUsage() [4/24]

static size_t memusage::DynamicUsage ( const int16_t &  v)
inlinestatic

Definition at line 33 of file memusage.h.

◆ DynamicUsage() [5/24]

static size_t memusage::DynamicUsage ( const int32_t &  v)
inlinestatic

Definition at line 35 of file memusage.h.

◆ DynamicUsage() [6/24]

static size_t memusage::DynamicUsage ( const int64_t &  v)
inlinestatic

Definition at line 37 of file memusage.h.

◆ DynamicUsage() [7/24]

static size_t memusage::DynamicUsage ( const int8_t &  v)
inlinestatic

Dynamic memory usage for built-in types is zero.

Definition at line 31 of file memusage.h.

Here is the caller graph for this function:

◆ DynamicUsage() [8/24]

template<unsigned int N, typename X , typename S , typename D >
static size_t memusage::DynamicUsage ( const prevector< N, X, S, D > &  v)
inlinestatic

Definition at line 107 of file memusage.h.

Here is the call graph for this function:

◆ DynamicUsage() [9/24]

template<typename X >
static size_t memusage::DynamicUsage ( const std::list< X > &  l)
inlinestatic

Definition at line 175 of file memusage.h.

Here is the call graph for this function:

◆ DynamicUsage() [10/24]

template<typename X , typename Y , typename Z >
static size_t memusage::DynamicUsage ( const std::map< X, Y, Z > &  m)
inlinestatic

Definition at line 125 of file memusage.h.

Here is the call graph for this function:

◆ DynamicUsage() [11/24]

template<typename X , typename Y >
static size_t memusage::DynamicUsage ( const std::set< X, Y > &  s)
inlinestatic

Definition at line 113 of file memusage.h.

Here is the call graph for this function:

◆ DynamicUsage() [12/24]

template<typename X >
static size_t memusage::DynamicUsage ( const std::shared_ptr< X > &  p)
inlinestatic

Definition at line 157 of file memusage.h.

Here is the call graph for this function:

◆ DynamicUsage() [13/24]

static size_t memusage::DynamicUsage ( const std::string &  s)
inlinestatic

Definition at line 94 of file memusage.h.

Here is the call graph for this function:

◆ DynamicUsage() [14/24]

template<typename X >
static size_t memusage::DynamicUsage ( const std::unique_ptr< X > &  p)
inlinestatic

Definition at line 151 of file memusage.h.

Here is the call graph for this function:

◆ DynamicUsage() [15/24]

template<class Key , class T , class Hash , class Pred , std::size_t MAX_BLOCK_SIZE_BYTES, std::size_t ALIGN_BYTES>
static size_t memusage::DynamicUsage ( const std::unordered_map< Key, T, Hash, Pred, PoolAllocator< std::pair< const Key, T >, MAX_BLOCK_SIZE_BYTES, ALIGN_BYTES > > &  m)
inlinestatic

Definition at line 200 of file memusage.h.

Here is the call graph for this function:

◆ DynamicUsage() [16/24]

template<typename X , typename Y , typename Z >
static size_t memusage::DynamicUsage ( const std::unordered_map< X, Y, Z > &  m)
inlinestatic

Definition at line 194 of file memusage.h.

Here is the call graph for this function:

◆ DynamicUsage() [17/24]

template<typename X , typename Y >
static size_t memusage::DynamicUsage ( const std::unordered_set< X, Y > &  s)
inlinestatic

Definition at line 188 of file memusage.h.

Here is the call graph for this function:

◆ DynamicUsage() [18/24]

template<typename T , typename Allocator >
static size_t memusage::DynamicUsage ( const std::vector< T, Allocator > &  v)
inlinestatic

Definition at line 89 of file memusage.h.

Here is the call graph for this function:

◆ DynamicUsage() [19/24]

static size_t memusage::DynamicUsage ( const uint16_t &  v)
inlinestatic

Definition at line 34 of file memusage.h.

◆ DynamicUsage() [20/24]

static size_t memusage::DynamicUsage ( const uint32_t &  v)
inlinestatic

Definition at line 36 of file memusage.h.

◆ DynamicUsage() [21/24]

static size_t memusage::DynamicUsage ( const uint64_t &  v)
inlinestatic

Definition at line 38 of file memusage.h.

◆ DynamicUsage() [22/24]

static size_t memusage::DynamicUsage ( const uint8_t &  v)
inlinestatic

Definition at line 32 of file memusage.h.

◆ DynamicUsage() [23/24]

template<typename X >
static size_t memusage::DynamicUsage ( const X *const &  v)
inlinestatic

Definition at line 42 of file memusage.h.

◆ DynamicUsage() [24/24]

template<typename X >
static size_t memusage::DynamicUsage ( X *const &  v)
inlinestatic

Definition at line 41 of file memusage.h.

◆ IncrementalDynamicUsage() [1/3]

template<typename X , typename Y >
static size_t memusage::IncrementalDynamicUsage ( const indirectmap< X, Y > &  m)
inlinestatic

Definition at line 145 of file memusage.h.

Here is the call graph for this function:

◆ IncrementalDynamicUsage() [2/3]

template<typename X , typename Y , typename Z >
static size_t memusage::IncrementalDynamicUsage ( const std::map< X, Y, Z > &  m)
inlinestatic

Definition at line 131 of file memusage.h.

Here is the call graph for this function:

◆ IncrementalDynamicUsage() [3/3]

template<typename X , typename Y >
static size_t memusage::IncrementalDynamicUsage ( const std::set< X, Y > &  s)
inlinestatic

Definition at line 119 of file memusage.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MallocUsage()

static size_t memusage::MallocUsage ( size_t  alloc)
inlinestatic

Compute the total memory used by allocating alloc bytes.

Compute the memory used for dynamically allocated but owned data structures.

For generic data types, this is not recursive. DynamicUsage(vector<vector<int> >) will compute the memory used for the vector<int>'s, but not for the ints inside. This is for efficiency reasons, as these functions are intended to be fast. If application data structures require more accurate inner accounting, they should iterate themselves, or use more efficient caching + updating on modification.

Definition at line 52 of file memusage.h.

Here is the call graph for this function:
Here is the caller graph for this function: