[cfe-dev] Possible Memory leak while compiling.
Alexandre Ganea via cfe-dev
cfe-dev at lists.llvm.org
Mon Nov 23 06:05:58 PST 2020
Hello Tomar,
If you look carefully at the invoked -cc1 command-line, there's a flag -disable-free which is always passed:
$ clang-cl /c a.cpp -###
clang version 12.0.0 (https://github.com/llvm/llvm-project.git 0eab9d5823815c6520697f8d725c402c88e5d050)
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: F:\llvm-project\__test\..\buildninjaRpMalloc2\bin
(in-process)
"F:\\llvm-project\\buildninjaRpMalloc2\\bin\\clang-cl.exe" "-cc1" "-triple" "x86_64-pc-windows-msvc19.28.29334" "-emit-obj" "-mrelax-all" "-mincremental-linker-compatible" "--mrelax-relocations" "-disable-free" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "a.cpp" "-mrelocation-model" "pic" "-pic-level" "2" "-mframe-pointer=none" "-relaxed-aliasing" "-fmath-errno" "-fno-rounding-math" "-mconstructor-aliases" "-munwind-tables" "-target-cpu" "x86-64" "-mllvm" "-x86-asm-syntax=intel" "-tune-cpu" "generic" "-D_MT" "-flto-visibility-public-std" "--dependent-lib=libcmt" "--dependent-lib=oldnames" "-stack-protector" "2" "-fms-volatile" "-fdiagnostics-format" "msvc" "-resource-dir" "F:\\llvm-project\\buildninjaRpMalloc2\\lib\\clang\\12.0.0" "-internal-isystem" "F:\\llvm-project\\buildninjaRpMalloc2\\lib\\clang\\12.0.0\\include" "-internal-isystem" "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\VC\\Tools\\MSVC\\14.28.29333\\ATLMFC\\include" "-internal-isystem" "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\VC\\Tools\\MSVC\\14.28.29333\\include" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8\\include\\um" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\ucrt" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\shared" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\um" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\winrt" "-internal-isystem" "C:\\Program Files (x86)\\Windows Kits\\10\\include\\10.0.18362.0\\cppwinrt" "-fdeprecated-macro" "-fdebug-compilation-dir" "F:\\llvm-project\\__test" "-ferror-limit" "19" "-fmessage-length=120" "-fno-use-cxa-atexit" "-fms-extensions" "-fms-compatibility" "-fms-compatibility-version=19.28.29334" "-std=c++14" "-fdelayed-template-parsing" "-fcolor-diagnostics" "-faddrsig" "-o" "a.obj" "-x" "c++" "a.cpp"
The purpose of the flag is to speed-up the process shutdown, by disabling heap deallocations on exit. It is used in conjunction with llvm::BuryPointer. Unless you call the -cc1 command directly or use libTooling, this flag is always active.
Alex.
De : llvm-dev <llvm-dev-bounces at lists.llvm.org> De la part de Tomar, Sourabh Singh via llvm-dev
Envoyé : November 23, 2020 8:43 AM
À : llvm-dev at lists.llvm.org
Objet : [llvm-dev] Possible Memory leak while compiling.
When compiling a .ll file as:
$ valgrind clang main.ll
I noticed lot of memory leaks:
==18396== HEAP SUMMARY:
==18396== in use at exit: 647,329 bytes in 619 blocks
==18396== total heap usage: 6,754 allocs, 6,135 frees, 1,571,191 bytes allocated
==18396==
==18396== LEAK SUMMARY:
==18396== definitely lost: 69,392 bytes in 4 blocks
==18396== indirectly lost: 374,050 bytes in 595 blocks
==18396== possibly lost: 12,207 bytes in 8 blocks
==18396== still reachable: 191,680 bytes in 12 blocks
==18396== suppressed: 0 bytes in 0 blocks
Is this okay ? or Known issue ?
Thanks,
Sourabh.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20201123/78ae44eb/attachment-0001.html>
More information about the cfe-dev
mailing list