Index: include/sanitizer/scudo_interface.h =================================================================== --- include/sanitizer/scudo_interface.h +++ include/sanitizer/scudo_interface.h @@ -27,6 +27,8 @@ // can be removed by setting LimitMb to 0. This function's parameters should // be fully trusted to avoid security mishaps. void __scudo_set_rss_limit(size_t LimitMb, int HardLimit); + + void __scudo_print_stats(void); #ifdef __cplusplus } // extern "C" #endif Index: lib/scudo/scudo_allocator.cpp =================================================================== --- lib/scudo/scudo_allocator.cpp +++ lib/scudo/scudo_allocator.cpp @@ -594,6 +594,11 @@ SoftRssLimitMb = LimitMb; CheckRssLimit = HardRssLimitMb || SoftRssLimitMb; } + + void printStats() { + initThreadMaybe(); + BackendAllocator.printStats(); + } }; static ScudoAllocator Instance(LINKER_INITIALIZED); @@ -743,3 +748,7 @@ return; Instance.setRssLimit(LimitMb, !!HardLimit); } + +void __scudo_print_stats() { + Instance.printStats(); +} Index: lib/scudo/scudo_allocator_combined.h =================================================================== --- lib/scudo/scudo_allocator_combined.h +++ lib/scudo/scudo_allocator_combined.h @@ -61,6 +61,11 @@ Stats.Get(StatType); } + void printStats() { + Primary.PrintStats(); + Secondary.PrintStats(); + } + private: PrimaryAllocator Primary; SecondaryAllocator Secondary; Index: lib/scudo/scudo_interface_internal.h =================================================================== --- lib/scudo/scudo_interface_internal.h +++ lib/scudo/scudo_interface_internal.h @@ -25,6 +25,9 @@ SANITIZER_INTERFACE_ATTRIBUTE void __scudo_set_rss_limit(uptr LimitMb, s32 HardLimit); + +SANITIZER_INTERFACE_ATTRIBUTE +void __scudo_print_stats(); } // extern "C" #endif // SCUDO_INTERFACE_INTERNAL_H_