summaryrefslogtreecommitdiff
path: root/lib/scudo/standalone/primary32.h
diff options
context:
space:
mode:
authorKostya Kortchinsky <kostyak@google.com>2019-08-14 16:04:01 +0000
committerKostya Kortchinsky <kostyak@google.com>2019-08-14 16:04:01 +0000
commitff30f73cc5aff8f0b0a3b9d4b9925de4679f2a00 (patch)
treef23f14f57755fb6c5b41c6ed07605097ecb0f9ef /lib/scudo/standalone/primary32.h
parent7c6dcf070a18942956867419ec19f348f2e929cc (diff)
downloadcompiler-rt-ff30f73cc5aff8f0b0a3b9d4b9925de4679f2a00.tar.gz
[scudo][standalone] Add more stats to mallinfo
Summary: Android requires additional stats in mallinfo. While we can provide right away the number of bytes mapped (Primary+Secondary), there was no way to get the number of free bytes (only makes sense for the Primary since the Secondary unmaps everything on deallocation). An approximation could be `StatMapped - StatAllocated`, but since we are mapping in `1<<17` increments for the 64-bit Primary, it's fairly inaccurate. So we introduce `StatFree` (note it's `Free`, not `Freed`!), which keeps track of the amount of Primary blocks currently unallocated. Reviewers: cferris, eugenis, vitalybuka, hctim, morehouse Reviewed By: morehouse Subscribers: delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D66112 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@368866 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/scudo/standalone/primary32.h')
-rw-r--r--lib/scudo/standalone/primary32.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/scudo/standalone/primary32.h b/lib/scudo/standalone/primary32.h
index 10f921a8d..79a11bfc1 100644
--- a/lib/scudo/standalone/primary32.h
+++ b/lib/scudo/standalone/primary32.h
@@ -318,6 +318,8 @@ private:
}
DCHECK(B);
DCHECK_GT(B->getCount(), 0);
+
+ C->getStats().add(StatFree, AllocatedUser);
Sci->AllocatedUser += AllocatedUser;
if (Sci->CanRelease)
Sci->ReleaseInfo.LastReleaseAtNs = getMonotonicTime();