<div dir="ltr"><div><div>Hi,<br><br></div>I am using the clang::CompilerInstance to compile a piece of code. I am running my tests through Clang -fsanitize=address.<br>The test case where the compilation succeeds does not leak any memory. But if the compilation fails, then it seems to leak memory.<br><br></div><div>Is this a known bug?<br><br></div><div>Am I supposed to explicitly freeup somethings when the compilation fails (The code already calls llvm::shut_down() towards the end of the process)<br><br></div><div>if(!clang.ExecuteAction(*action)) { throw new CompilationError("failed to compile", std::move(errors)); }<br><br></div><div>The rest of the code looks similar to what others have posted on the internet (but haven't gotten a response yet):<br><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__stackoverflow.com_questions_24314060_clang-2Din-2Dmemory-2Dparser-2Ddoes-2Dnot-2Dperform-2Dfull-2Dclean-2Dup-2Dfor-2Dthe-2Dmemory-2Dit-2Dallocate&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=d1qrfJ1v79bz2Aj_inO-nnU1nf93OLJfj6EQKFH_oEk&s=1rk2IxRtI9x52gFg31bQmHoyFEx1TERpzlwPSxvdMe0&e=">http://stackoverflow.com/questions/24314060/clang-in-memory-parser-does-not-perform-full-clean-up-for-the-memory-it-allocate</a><br><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__clang-2Ddevelopers.42468.n3.nabble.com_Running-2Dmultiple-2Dactions-2Dwith-2Dclang-2Dinterpreter-2Dwithout-2Dmemory-2Dleak-2Dtd3451862.html&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=Mfk2qtn1LTDThVkh6-oGglNfMADXfJdty4_bhmuhMHA&m=d1qrfJ1v79bz2Aj_inO-nnU1nf93OLJfj6EQKFH_oEk&s=nZwlivA72dIesXAEKnVVYRAGtY2HnFE08KnNAxQ83jc&e=">http://clang-developers.42468.n3.nabble.com/Running-multiple-actions-with-clang-interpreter-without-memory-leak-td3451862.html</a><br><br></div><div>I am using Clang3.5<br><br></div><div>Thanks!<br></div><div>Ajay<br></div></div>