This is an archive of the discontinued LLVM Phabricator instance.

[sanitizer] Consolidate some LowLevelAllocators to one
ClosedPublic

Authored by leonardchan on Aug 24 2023, 3:12 PM.

Details

Summary

This removes and replaces usage of a few LowLevelAllocators with a single one provided by sanitizer_common. Functionally, there should be no difference between using different allocators vs the same one. This works really well with D158783 which controls the size of each allocator mmap to significantly reduce fragmentation.

This doesn't remove them all, mainly the ones used by asan and the flag parser.

Diff Detail

Event Timeline

leonardchan created this revision.Aug 24 2023, 3:12 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2023, 3:12 PM
Herald added a subscriber: Enna1. · View Herald Transcript
fabio-d added inline comments.Aug 25 2023, 4:59 AM
compiler-rt/lib/sanitizer_common/sanitizer_common.h
208

nit: Maybe update the comment here pointing future users to reusing the global instance instead of instantiating a private one?

232

I'm not familiar with this code base, so feel free to ignore me. I wonder if it would make sense to decree that LowLevelAllocator is now a singleton, and make this function a static method in it, eg LowLevelAllocator::GetGlobalInstance()

vitalybuka accepted this revision.Aug 25 2023, 3:11 PM
This revision is now accepted and ready to land.Aug 25 2023, 3:11 PM
MaskRay accepted this revision.Aug 25 2023, 3:39 PM
This revision was automatically updated to reflect the committed changes.
leonardchan marked 2 inline comments as done.