mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-04 13:55:23 -05:00
add std::list to memusage
This commit is contained in:
parent
59a35a7398
commit
79ce9f0aa4
1 changed files with 16 additions and 0 deletions
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
@ -148,6 +149,21 @@ static inline size_t DynamicUsage(const std::shared_ptr<X>& p)
|
|||
return p ? MallocUsage(sizeof(X)) + MallocUsage(sizeof(stl_shared_counter)) : 0;
|
||||
}
|
||||
|
||||
template<typename X>
|
||||
struct list_node
|
||||
{
|
||||
private:
|
||||
void* ptr_next;
|
||||
void* ptr_prev;
|
||||
X x;
|
||||
};
|
||||
|
||||
template<typename X>
|
||||
static inline size_t DynamicUsage(const std::list<X>& l)
|
||||
{
|
||||
return MallocUsage(sizeof(list_node<X>)) * l.size();
|
||||
}
|
||||
|
||||
template<typename X>
|
||||
struct unordered_node : private X
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue