[all-commits] [llvm/llvm-project] 3eb16f: [LLD] Have only one SpecificAllocator per type

Reid Kleckner via All-commits all-commits at lists.llvm.org
Tue Jun 2 14:09:28 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 3eb16fe4e945631988d6d302d0bc317d8c07279c
      https://github.com/llvm/llvm-project/commit/3eb16fe4e945631988d6d302d0bc317d8c07279c
  Author: Reid Kleckner <rnk at google.com>
  Date:   2020-06-02 (Tue, 02 Jun 2020)

  Changed paths:
    M lld/include/lld/Common/Memory.h

  Log Message:
  -----------
  [LLD] Have only one SpecificAllocator per type

Previously, the SpecificAllocator was a static local in the `make<T>`
function template. Using static locals is nice because they are only
constructed and registered if they are accessed. However, if there are
multiple calls to make<> with different constructor parameters, we would
get multiple static local variable instances. This is undesirable and
leads to extra memory allocations. I noticed there were two sources of
DefinedRegular allocations while checking heap profiles.




More information about the All-commits mailing list