-
Yonghong Song authored
In clang frontend actions, several compiler invocations are called for rewriter and transforming source code to IR. During the invocation to transform source code to IR, CodeGenOpts.DisableFree is used to control whether the top target machine structure should be freed or not for a particular clang invocation, and its default value is TRUE. See clang:lib/CodeGen/BackendUtil.cpp: ~EmitAssemblyHelper() { if (CodeGenOpts.DisableFree) BuryPointer(std::move(TM)); } So by default, the memory held by TM will not freed, even if BPF module itself is freed. This is even more problematic when continuous building/loading/unloading happens for long live service. This patch explicitly sets CodeGenOpts.DisableFree to FALSE so memory can be properly freed. I did a simple experiment to compile/load/unload an empty BPF program and the saving is roughly 0.5MB. Signed-off-by:
Yonghong Song <yhs@fb.com>
6ed2229d