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

Dmitry Vyukov via All-commits all-commits at lists.llvm.org
Tue Jul 13 01:02:37 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d89d3dfae17d7795dc1ef013db66272020de1959
      https://github.com/llvm/llvm-project/commit/d89d3dfae17d7795dc1ef013db66272020de1959
  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
    M compiler-rt/lib/sanitizer_common/tests/sanitizer_allocator_test.cpp

  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