<div dir="ltr">(This is repost of my previous post to llvm-dev <a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-March/060691.html">http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-March/060691.html</a><br> I sent my patch to a wrong list, sorry)<br>
<br>Hi, I'm Ryo Onodera.<br>
<br>
This is my first post to this mailing list. Fist, thanks for creating<br>
a great library!<br>
<br>
We're using LLVM to support JIT in Rubinius (an alternative<br>
implementation of Ruby, a dynamic programming language).<br>
<br>
I'm submitting a small patch for a minor issue.<br>
<br>
It solves still-reachable leak warnings from Valgrind. Example<br>
warnings are shown at the end of this mail.<br>
<br>
As these warnings weren't considered problematic in the past(*1), I<br>
know this is really minor issue. But, I want to fix it to reduce<br>
noises when using Valgrind, not resorting to Valgrind's suppression<br>
mechanism.<br>
<br>
This patch contains no functional change. And it should cause no problem.<br>
<br>
Since this is my first patch to LLVM, please let me know any<br>
corrections. I'll greatly appreciate them and happily update my patch.<br>
<br>
Also, LLVM's codebase is really clean. It took little time to make this patch.<br>
<br>
The actual warnings are like this:<br>
<br>
==26332== 40 bytes in 1 blocks are still reachable in loss record 5 of 10<br>
==26332==    at 0x4C2B3F8: malloc (in<br>
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)<br>
==26332==    by 0x165CC6C: llvm::sys::MutexImpl::MutexImpl(bool) (Mutex.cpp:49)<br>
==26332==    by 0xD41D5A:<br>
llvm::sys::SmartMutex<true>::SmartMutex(bool) (Mutex.h:94)<br>
==26332==    by 0xD3E81F: void*<br>
llvm::object_creator<llvm::sys::SmartMutex<true> >()<br>
(ManagedStatic.h:26)<br>
==26332==    by 0x165AA95:<br>
llvm::ManagedStaticBase::RegisterManagedStatic(void* (*)(), void<br>
(*)(void*)) const (ManagedStatic.cpp:50)<br>
==26332==    by 0xD3C372:<br>
llvm::ManagedStatic<llvm::sys::SmartMutex<true> >::operator*()<br>
(ManagedStatic.h:68)<br>
==26332==    by 0x1605FE2:<br>
llvm::PassRegistry::removeRegistrationListener(llvm::PassRegistrationListener*)<br>
(PassRegistry.cpp:195)<br>
==26332==    by 0x15F1FC5:<br>
llvm::PassRegistrationListener::~PassRegistrationListener()<br>
(Pass.cpp:211)<br>
==26332==    by 0x15F2074: llvm::PassNameParser::~PassNameParser()<br>
(Pass.cpp:221)<br>
==26332==    by 0x1604973: llvm::cl::list<llvm::PassInfo const*, bool,<br>
llvm::PassNameParser>::~list() (in<br>
/home/ryoqun/rubinius/ryoqun/bin/rbx)<br>
==26332==    by 0x5EE4900: __run_exit_handlers (exit.c:78)<br>
==26332==    by 0x5EE4984: exit (exit.c:100)<br>
<br>
*1 <a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-January/046828.html" target="_blank">http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-January/046828.html</a><br>
<br>
Regards,<br></div>