<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Segoe UI";
        panose-1:2 11 5 2 4 2 4 2 2 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-CA" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span lang="FR-CA" style="mso-fareast-language:EN-US">Hello Tomar,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-CA" style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">If you look carefully at the invoked -cc1 command-line, there’s a flag
<span style="background:yellow;mso-highlight:yellow">-disable-free</span> which is always passed:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">$ clang-cl /c a.cpp -###<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="FR-CA" style="mso-fareast-language:EN-US">clang version 12.0.0 (https://github.com/llvm/llvm-project.git 0eab9d5823815c6520697f8d725c402c88e5d050)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Target: x86_64-pc-windows-msvc<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Thread model: posix<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">InstalledDir: F:\llvm-project\__test\..\buildninjaRpMalloc2\bin<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">(in-process)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">"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"
<span style="background:yellow;mso-highlight:yellow">"-disable-free"</span> "-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"<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">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</span><span style="font-size:9.0pt;font-family:"Segoe UI",sans-serif;color:black">.
</span><span style="mso-fareast-language:EN-US">Unless you call the -cc1 command directly or use libTooling, this flag is always active.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">Alex.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="FR">De :</span></b><span lang="FR"> llvm-dev <llvm-dev-bounces@lists.llvm.org>
<b>De la part de</b> Tomar, Sourabh Singh via llvm-dev<br>
<b>Envoyé :</b> November 23, 2020 8:43 AM<br>
<b>À :</b> llvm-dev@lists.llvm.org<br>
<b>Objet :</b> [llvm-dev] Possible Memory leak while compiling.<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US">When compiling a .ll file as:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">$ valgrind clang main.ll<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I noticed lot of memory leaks:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">==18396== HEAP SUMMARY:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">==18396==     in use at exit: 647,329 bytes in 619 blocks<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">==18396==   total heap usage: 6,754 allocs, 6,135 frees, 1,571,191 bytes allocated<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">==18396==<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">==18396== LEAK SUMMARY:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">==18396==    definitely lost: 69,392 bytes in 4 blocks<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">==18396==    indirectly lost: 374,050 bytes in 595 blocks<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">==18396==      possibly lost: 12,207 bytes in 8 blocks<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">==18396==    still reachable: 191,680 bytes in 12 blocks<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">==18396==         suppressed: 0 bytes in 0 blocks<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Is this okay ? or Known issue ?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Sourabh.<o:p></o:p></span></p>
</div>
</body>
</html>