<div dir="ltr"><div><div><div>Hi,<br><br></div><div>Thanks for trying my patch!<br><br></div>I've prepared a minimal test case. Could you give it a try?<br><br></div><div>Build the attached source file and run like this:<br>
</div><br>$ clang++ -g -O3 toy.cpp `/path/to//llvm-config --cppflags --libs` `/path/to/llvm-config --ldflags` -o toy && valgrind --show-reachable=yes --leak-check=full ./toy<br><br></div>Regards,<br><div><br><div>
<div><div><div><div class="gmail_extra"><div class="gmail_quote">On Wed, May 8, 2013 at 11:02 PM, Rafael Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">How are you getting these warning? I tried running<br>
<br>
valgrind --leak-check=full --show-reachable=yes .opt -instnamer<br>
test.ll  -o test.bc<br>
<br>
And I get the same 96 bytes with or without your patch.<br>
<div class=""><div class="h5"><br>
On 1 April 2013 19:50, Ryo Onodera <<a href="mailto:ryoqun@gmail.com">ryoqun@gmail.com</a>> wrote:<br>
> (This is repost of my previous post to llvm-dev<br>
> <a href="http://lists.cs.uiuc.edu/pipermail/llvmdev/2013-March/060691.html" target="_blank">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<br>
> 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)<br>
> (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>
><br>
</div></div><div class=""><div class="h5">> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr"> ryo   | 小野寺 諒   | <a href="mailto:ryoqun@gmail.com" target="_blank">ryoqun@gmail.com</a><br>
   qun | Ryo Onodera | <a href="http://ryoqun.github.com/" target="_blank">http://ryoqun.github.com/</a><br>
       |             | 090-1264-2619</div>
</div></div></div></div></div></div></div>