diff options
author | Kostya Kortchinsky <kostyak@google.com> | 2019-08-14 16:04:01 +0000 |
---|---|---|
committer | Kostya Kortchinsky <kostyak@google.com> | 2019-08-14 16:04:01 +0000 |
commit | ff30f73cc5aff8f0b0a3b9d4b9925de4679f2a00 (patch) | |
tree | f23f14f57755fb6c5b41c6ed07605097ecb0f9ef /lib/scudo/standalone/primary64.h | |
parent | 7c6dcf070a18942956867419ec19f348f2e929cc (diff) | |
download | compiler-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/primary64.h')
-rw-r--r-- | lib/scudo/standalone/primary64.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/scudo/standalone/primary64.h b/lib/scudo/standalone/primary64.h index 0149edc89..fd3709ecb 100644 --- a/lib/scudo/standalone/primary64.h +++ b/lib/scudo/standalone/primary64.h @@ -309,6 +309,7 @@ private: DCHECK(B); DCHECK_GT(B->getCount(), 0); + C->getStats().add(StatFree, AllocatedUser); Region->AllocatedUser += AllocatedUser; Region->Exhausted = false; if (Region->CanRelease) |