14 #ifndef STXXL_UTILS_MALLOC_HEADER
15 #define STXXL_UTILS_MALLOC_HEADER
20 #if STXXL_HAVE_MALLINFO_PROTO
35 #if STXXL_HAVE_MALLINFO_PROTO
38 typedef int return_type;
41 return_type from_system_nmmap()
const
43 struct mallinfo info = mallinfo();
48 return_type free_chunks()
const
50 struct mallinfo info = mallinfo();
55 return_type used()
const
57 struct mallinfo info = mallinfo();
62 return_type not_used()
const
64 struct mallinfo info = mallinfo();
69 return_type releasable()
const
71 struct mallinfo info = mallinfo();
76 return_type max_allocated()
const
78 struct mallinfo info = mallinfo();
83 return_type fastbin_blocks()
const
85 struct mallinfo info = mallinfo();
90 return_type fastbin_free()
const
92 struct mallinfo info = mallinfo();
97 return_type from_system_mmap()
const
99 struct mallinfo info = mallinfo();
104 return_type mmap_chunks()
const
106 struct mallinfo info = mallinfo();
111 return_type from_system_total()
const
113 return from_system_nmmap() + from_system_mmap();
121 #if STXXL_HAVE_MALLINFO_PROTO
122 s <<
"MALLOC statistics" << std::endl;
123 s <<
"=================================================================" << std::endl;
124 s <<
"Space allocated from system not using mmap: " << st.from_system_nmmap() <<
" bytes" << std::endl;
125 s <<
" number of free chunks : " << st.free_chunks() << std::endl;
126 s <<
" space allocated and in use : " << st.used() <<
" bytes" << std::endl;
127 s <<
" space allocated but not in use : " << st.not_used() <<
" bytes" << std::endl;
128 s <<
" top-most, releasable (via malloc_trim) space: " << st.releasable() <<
" bytes" << std::endl;
129 s <<
" maximum total allocated space (?) : " << st.max_allocated() <<
" bytes" << std::endl;
130 s <<
" FASTBIN blocks " << std::endl;
131 s <<
" number of fastbin blocks: " << st.fastbin_blocks() << std::endl;
132 s <<
" space available in freed fastbin blocks: " << st.fastbin_free() <<
" bytes" << std::endl;
133 s <<
"Space allocated from system using mmap: " << st.from_system_mmap() <<
" bytes" << std::endl;
134 s <<
" number of chunks allocated via mmap(): " << st.mmap_chunks() << std::endl;
135 s <<
"Total space allocated from system (mmap and not mmap): " <<
136 st.from_system_total() <<
" bytes" << std::endl;
137 s <<
"=================================================================" << std::endl;
139 s <<
"MALLOC statistics are not supported on this platform";
150 #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