This is an archive of the discontinued LLVM Phabricator instance.

[scudo][standalone] Add more stats to mallinfo
ClosedPublic

Authored by cryptoad on Aug 12 2019, 3:07 PM.

Details

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.

Diff Detail

Repository
rL LLVM

Event Timeline

cryptoad created this revision.Aug 12 2019, 3:07 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptAug 12 2019, 3:07 PM
Herald added subscribers: Restricted Project, delcypher. · View Herald Transcript
cryptoad updated this revision to Diff 214724.Aug 12 2019, 3:35 PM

Adding usmblks as well.
Android uses it for getNativeHeapSize, so StatMapped will do.

This revision is now accepted and ready to land.Aug 13 2019, 9:45 AM
This revision was automatically updated to reflect the committed changes.