[all-commits] [llvm/llvm-project] 7bc00c: [clang-repl] Remove memory leak of ASTContext/Targ...

Sunho Kim via All-commits all-commits at lists.llvm.org
Fri Jun 17 14:36:54 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7bc00ce5cd41aad5fd0775f58c8e85a0a8d9ee56
      https://github.com/llvm/llvm-project/commit/7bc00ce5cd41aad5fd0775f58c8e85a0a8d9ee56
  Author: Sunho Kim <ksunhokim123 at gmail.com>
  Date:   2022-06-18 (Sat, 18 Jun 2022)

  Changed paths:
    M clang/lib/Interpreter/IncrementalParser.cpp
    M clang/lib/Interpreter/Interpreter.cpp

  Log Message:
  -----------
  [clang-repl] Remove memory leak of ASTContext/TargetMachine.

Removes memory leak of ASTContext and TargetMachine. When DisableFree is turned on, it intentionally leaks these instances as they can be trivially deallocated. This patch turns this off and delete Parser instance early so that they will not reference dangling pargma headers.

Asan shouldn't detect these as leaks normally, since burypointer is called for them. But, every invocation of incremental parser createa an additional leak of TargetMachine. If there are many invocations within a single test case, we easily reach number of leaks exceeding kGraveYardMaxSize (which is 12) and leaks start to get reported by asan buildbots.

Reviewed By: v.g.vassilev

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




More information about the All-commits mailing list