Skip to content

Commit 5759e3c

Browse files
committed
[scudo] Add mallopt to print stats to the log.
Reviewed By: Chia-hungDuan Differential Revision: https://reviews.llvm.org/D153094
1 parent fecabf4 commit 5759e3c

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

compiler-rt/lib/scudo/standalone/include/scudo/interface.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ size_t __scudo_get_ring_buffer_size(void);
159159
#define M_MEMTAG_TUNING_UAF 1
160160
#endif
161161

162+
// Print internal stats to the log.
163+
#ifndef M_LOG_STATS
164+
#define M_LOG_STATS -205
165+
#endif
166+
162167
} // extern "C"
163168

164169
#endif // SCUDO_INTERFACE_H_

compiler-rt/lib/scudo/standalone/wrappers_c.inc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,9 @@ INTERFACE WEAK int SCUDO_PREFIX(mallopt)(int param, int value) {
196196
} else if (param == M_PURGE_ALL) {
197197
SCUDO_ALLOCATOR.releaseToOS(scudo::ReleaseToOS::ForceAll);
198198
return 1;
199+
} else if (param == M_LOG_STATS) {
200+
SCUDO_ALLOCATOR.printStats();
201+
return 1;
199202
} else {
200203
scudo::Option option;
201204
switch (param) {

0 commit comments

Comments
 (0)