[PATCH] Avoid Valgrind's still-reachable leak warnings

David Blaikie dblaikie at gmail.com
Sun Apr 28 07:59:15 PDT 2013


Bump for code review at some point
On Apr 2, 2013 10:52 AM, "Ryo Onodera" <ryoqun at gmail.com> wrote:

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


More information about the llvm-commits mailing list