[all-commits] [llvm/llvm-project] 832ba2: sanitizer_common: optimize memory drain

Dmitry Vyukov via All-commits all-commits at lists.llvm.org
Tue Jul 13 16:29:06 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 832ba20710ee09b00161ea72cf80c9af800fda63
      https://github.com/llvm/llvm-project/commit/832ba20710ee09b00161ea72cf80c9af800fda63
  Author: Dmitry Vyukov <dvyukov at google.com>
  Date:   2021-07-13 (Tue, 13 Jul 2021)

  Changed paths:
    M compiler-rt/lib/sanitizer_common/sanitizer_allocator_local_cache.h
    M compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h

  Log Message:
  -----------
  sanitizer_common: optimize memory drain

Currently we allocate MemoryMapper per size class.
MemoryMapper mmap's and munmap's internal buffer.
This results in 50 mmap/munmap calls under the global
allocator mutex. Reuse MemoryMapper and the buffer
for all size classes. This radically reduces number of
mmap/munmap calls. Smaller size classes tend to have
more objects allocated, so it's highly likely that
the buffer allocated for the first size class will
be enough for all subsequent size classes.

Reviewed By: melver

Differential Revision: https://reviews.llvm.org/D105778




More information about the All-commits mailing list