Humm, when I run valgrind over my code I'm getting:<div><br></div><div><div>==30376== </div><div>==30376== HEAP SUMMARY:</div><div>==30376==     in use at exit: 1,928 bytes in 25 blocks</div><div>==30376==   total heap usage: 28,193 allocs, 28,168 frees, 2,194,616 bytes allocated</div>
<div>==30376== </div><div>==30376== 1,864 (1,056 direct, 808 indirect) bytes in 1 blocks are definitely lost in loss record 15 of 15</div><div>==30376==    at 0x4C28973: operator new(unsigned long) (vg_replace_malloc.c:261)</div>
<div>==30376==    by 0x57C7A62: clang::ASTUnit::Parse(llvm::MemoryBuffer*) (in /home/doug/projects/cparse/deps/llvm/build/lib/liblibclang.so.3.0)</div><div>==30376==    by 0x57CB686: clang::ASTUnit::LoadFromCompilerInvocation(bool) (in /home/doug/projects/cparse/deps/llvm/build/lib/liblibclang.so.3.0)</div>
<div>==30376==    by 0x57CBF0F: clang::ASTUnit::LoadFromCommandLine(char const**, char const**, llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine>, llvm::StringRef, bool, bool, std::pair<std::string, llvm::PointerUnion<char const*, llvm::MemoryBuffer const*> >*, unsigned int, bool, bool, clang::TranslationUnitKind, bool, bool) (in /home/doug/projects/cparse/deps/llvm/build/lib/liblibclang.so.3.0)</div>
<div>==30376==    by 0x54F5E14: clang_parseTranslationUnit_Impl (in /home/doug/projects/cparse/deps/llvm/build/lib/liblibclang.so.3.0)</div><div>==30376==    by 0x5E3BD89: llvm::CrashRecoveryContext::RunSafely(void (*)(void*), void*) (in /home/doug/projects/cparse/deps/llvm/build/lib/liblibclang.so.3.0)</div>
<div>==30376==    by 0x5E3BE90: RunSafelyOnThread_Dispatch(void*) (in /home/doug/projects/cparse/deps/llvm/build/lib/liblibclang.so.3.0)</div><div>==30376==    by 0x5E72924: ExecuteOnThread_Dispatch(void*) (in /home/doug/projects/cparse/deps/llvm/build/lib/liblibclang.so.3.0)</div>
<div>==30376==    by 0x6D82970: start_thread (pthread_create.c:304)</div><div>==30376==    by 0x68DA92C: clone (clone.S:112)</div><div>==30376== </div><div>==30376== LEAK SUMMARY:</div><div>==30376==    definitely lost: 1,056 bytes in 1 blocks</div>
</div><div><br></div><div>I'm a little lost as to if this is something I'm doing wrong on my code, or some kind of clang internal thing (seems internal, but I wouldnt have expected clang to leak memory, so I suspect perhaps I'm not cleaning up correctly after use?).</div>
<div><br></div><div>Any suggestions how to track this down?</div><div><br></div><div>My code is roughly like:</div><div><br></div><div>clang_createIndex(...);</div><div>clang_createTranslationUnitFromSourceFile(...);</div>
<div>clang_getTranslationUnitCursor(...);</div><div>clang_visitChildren(...);</div><div>clang_disposeTranslationUnit(...);</div><div>clang_disposeIndex(...);</div><div><br></div><div>Is there some other shutdown I need to run?</div>
<div><br></div><div>~</div><div>Doug.</div>