Skip to content

Commit

Permalink
[scudo] Add mallopt to print stats to the log.
Browse files Browse the repository at this point in the history
Reviewed By: Chia-hungDuan

Differential Revision: https://reviews.llvm.org/D153094
  • Loading branch information
cferris1000 committed Jun 16, 2023
1 parent fecabf4 commit 5759e3c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions compiler-rt/lib/scudo/standalone/include/scudo/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ size_t __scudo_get_ring_buffer_size(void);
#define M_MEMTAG_TUNING_UAF 1
#endif

// Print internal stats to the log.
#ifndef M_LOG_STATS
#define M_LOG_STATS -205
#endif

} // extern "C"

#endif // SCUDO_INTERFACE_H_
3 changes: 3 additions & 0 deletions compiler-rt/lib/scudo/standalone/wrappers_c.inc
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ INTERFACE WEAK int SCUDO_PREFIX(mallopt)(int param, int value) {
} else if (param == M_PURGE_ALL) {
SCUDO_ALLOCATOR.releaseToOS(scudo::ReleaseToOS::ForceAll);
return 1;
} else if (param == M_LOG_STATS) {
SCUDO_ALLOCATOR.printStats();
return 1;
} else {
scudo::Option option;
switch (param) {
Expand Down

0 comments on commit 5759e3c

Please sign in to comment.