[PATCH] D66112: [scudo][standalone] Add more stats to mallinfo

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 12 15:08:54 PDT 2019


cryptoad created this revision.
cryptoad added reviewers: cferris, eugenis, vitalybuka, hctim, morehouse.
Herald added subscribers: Sanitizers, delcypher.
Herald added projects: LLVM, Sanitizers.

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.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D66112

Files:
  lib/scudo/standalone/local_cache.h
  lib/scudo/standalone/mutex.h
  lib/scudo/standalone/primary32.h
  lib/scudo/standalone/primary64.h
  lib/scudo/standalone/stats.h
  lib/scudo/standalone/tests/wrappers_c_test.cpp
  lib/scudo/standalone/wrappers_c.inc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66112.214716.patch
Type: text/x-patch
Size: 4588 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190812/27d462ae/attachment.bin>


More information about the llvm-commits mailing list