14 #ifndef STXXL_UTILS_MALLOC_HEADER
15 #define STXXL_UTILS_MALLOC_HEADER
20 #if STXXL_HAVE_MALLINFO_PROTO
37 #if STXXL_HAVE_MALLINFO_PROTO
40 typedef int return_type;
43 return_type from_system_nmmap()
const
45 struct mallinfo info = mallinfo();
50 return_type free_chunks()
const
52 struct mallinfo info = mallinfo();
57 return_type used()
const
59 struct mallinfo info = mallinfo();
64 return_type not_used()
const
66 struct mallinfo info = mallinfo();
71 return_type releasable()
const
73 struct mallinfo info = mallinfo();
78 return_type max_allocated()
const
80 struct mallinfo info = mallinfo();
85 return_type fastbin_blocks()
const
87 struct mallinfo info = mallinfo();
92 return_type fastbin_free()
const
94 struct mallinfo info = mallinfo();
99 return_type from_system_mmap()
const
101 struct mallinfo info = mallinfo();
106 return_type mmap_chunks()
const
108 struct mallinfo info = mallinfo();
113 return_type from_system_total()
const
115 return from_system_nmmap() + from_system_mmap();
123 #if STXXL_HAVE_MALLINFO_PROTO
124 s <<
"MALLOC statistics" << std::endl;
125 s <<
"=================================================================" << std::endl;
126 s <<
"Space allocated from system not using mmap: " << st.from_system_nmmap() <<
" bytes" << std::endl;
127 s <<
" number of free chunks : " << st.free_chunks() << std::endl;
128 s <<
" space allocated and in use : " << st.used() <<
" bytes" << std::endl;
129 s <<
" space allocated but not in use : " << st.not_used() <<
" bytes" << std::endl;
130 s <<
" top-most, releasable (via malloc_trim) space: " << st.releasable() <<
" bytes" << std::endl;
131 s <<
" maximum total allocated space (?) : " << st.max_allocated() <<
" bytes" << std::endl;
132 s <<
" FASTBIN blocks " << std::endl;
133 s <<
" number of fastbin blocks: " << st.fastbin_blocks() << std::endl;
134 s <<
" space available in freed fastbin blocks: " << st.fastbin_free() <<
" bytes" << std::endl;
135 s <<
"Space allocated from system using mmap: " << st.from_system_mmap() <<
" bytes" << std::endl;
136 s <<
" number of chunks allocated via mmap(): " << st.mmap_chunks() << std::endl;
137 s <<
"Total space allocated from system (mmap and not mmap): " <<
138 st.from_system_total() <<
" bytes" << std::endl;
139 s <<
"=================================================================" << std::endl;
141 s <<
"MALLOC statistics are not supported on this platform";
152 #endif // !STXXL_UTILS_MALLOC_HEADER
friend std::ostream & operator<<(std::ostream &os, const uint_pair &a)
make a uint_pair outputtable via iostreams, using unsigned long long.
Access to some useful malloc statistics.
#define STXXL_BEGIN_NAMESPACE
void STXXL_UNUSED(const U &)
#define STXXL_END_NAMESPACE