8 #ifndef ATHENAAUDITORS_MEMORYHOOKSCOMMON_H
9 #define ATHENAAUDITORS_MEMORYHOOKSCOMMON_H
16 #include "gperftools/malloc_hook.h"
22 #include <boost/intrusive/splay_set.hpp>
24 #define UNW_LOCAL_ONLY
26 #if defined(__clang__)
27 # pragma clang diagnostic push
28 # if __has_warning("-Wextern-c-compat")
29 # pragma clang diagnostic ignored "-Wextern-c-compat"
32 #include "libunwind.h"
33 #if defined(__clang__)
34 # pragma clang diagnostic pop
45 static std::map<std::string, aiStruct> arrayAlgIndex;
46 static std::map<uint32_t, std::string> algorithms;
51 static bool initialized(
false);
52 static bool finished(
false);
54 static uintptr_t context(0);
55 static uintptr_t contextFirst(0);
57 static std::string defaultString =
"N/A";
59 static size_t stacktraceDepth(25);
61 static bool collectStacktraces(
true);
65 class myBlocks_tc :
public boost::intrusive::bs_set_base_hook<boost::intrusive::optimize_size<false> >
93 return a.allocated <
b.allocated;
98 return a.allocated >
b.allocated;
103 return a.allocated ==
b.allocated;
109 using allocSet_tc = boost::intrusive::splay_set< myBlocks_tc, boost::intrusive::base_hook<boost::intrusive::bs_set_base_hook<> > > ;