5#ifndef BITCOIN_MEMUSAGE_H
6#define BITCOIN_MEMUSAGE_H
18#include <unordered_map>
19#include <unordered_set>
39template<
typename X>
static inline size_t DynamicUsage(
X *
const &v) {
return 0; }
40template<
typename X>
static inline size_t DynamicUsage(
const X *
const &v) {
return 0; }
55 }
else if (
sizeof(
void*) == 8) {
56 return ((alloc + 31) >> 4) << 4;
57 }
else if (
sizeof(
void*) == 4) {
58 return ((alloc + 15) >> 3) << 3;
92template<
unsigned int N,
typename X,
typename S,
typename D>
98template<
typename X,
typename Y>
104template<
typename X,
typename Y>
110template<
typename X,
typename Y,
typename Z>
116template<
typename X,
typename Y,
typename Z>
124template<
typename X,
typename Y>
130template<
typename X,
typename Y>
158template<
typename X,
typename Y>
164template<
typename X,
typename Y,
typename Z>
Implements a drop-in replacement for std::vector<T> which stores up to N elements directly (without h...
size_t allocated_memory() const
static size_t DynamicUsage(const int8_t &v)
Dynamic memory usage for built-in types is zero.
static size_t IncrementalDynamicUsage(const std::set< X, Y > &s)
static size_t MallocUsage(size_t alloc)
Compute the total memory used by allocating alloc bytes.