18 #ifndef ION_BASE_ALLOCTRACKER_H_
19 #define ION_BASE_ALLOCTRACKER_H_
27 #define ION_ALLOC_TRACKER_DEFINED 1
31 #if defined(__cplusplus)
36 #include "base/integral_types.h"
45 class ION_API AllocTracker {
53 static const int kNumAllocTypes = kInternalAlloc + 1;
57 TypeCounts() : allocs(0), bytes(0) {}
64 TypeCounts counts[kNumAllocTypes];
68 static AllocTracker* GetMutableInstance();
69 static const AllocTracker& GetInstance();
79 const Counts& GetBaselineCounts()
const {
return baseline_counts_; }
82 const Counts& GetAllCounts()
const {
return all_counts_; }
86 const Counts& GetOpenCounts()
const {
return open_counts_; }
89 void* New(std::size_t size, AllocType
type);
90 void Delete(
void* ptr, AllocType type);
97 virtual ~AllocTracker();
99 Counts baseline_counts_;
103 std::unique_ptr<Helper> helper_;
112 void*
operator new(std::size_t size);
113 void*
operator new[](std::size_t size);
114 void operator delete(
void* ptr);
115 void operator delete[](
void* ptr);
117 #endif // __cplusplus
119 #endif // ION_BASE_ALLOCTRACKER_H_