Fun with valgrind

12 posts / 0 new
Last post
Rock Hardbuns
Offline
Last seen: 3 years 1 month ago
Joined: 22 Nov 2005 - 00:10
Fun with valgrind

I decided to give valgrind a try, and I'm sort of impressed. I ran my app through and horror of horrors, it it was leaking!
However, I couldn't see how the leak was my fault really. So I ran Juce demo through valgrind too, with much the same result.

I am however still unsure how to read the results.

Some entries like this one:

==2727== 112 (8 direct, 104 indirect) bytes in 1 blocks are definitely lost in loss record 14 of 26
==2727==    at 0x401C487: realloc (vg_replace_malloc.c:306)
==2727==    by 0x40FE4D3: (within /usr/lib/libX11.so.6.2.0)
==2727==    by 0x40FEF3B: (within /usr/lib/libX11.so.6.2.0)
==2727==    by 0x4100C97: _XlcCreateLC (in /usr/lib/libX11.so.6.2.0)
==2727==    by 0x411EEAA: _XlcDefaultLoader (in /usr/lib/libX11.so.6.2.0)
==2727==    by 0x41077AE: _XOpenLC (in /usr/lib/libX11.so.6.2.0)
==2727==    by 0x410789D: _XrmInitParseInfo (in /usr/lib/libX11.so.6.2.0)
==2727==    by 0x40F14C0: (within /usr/lib/libX11.so.6.2.0)
==2727==    by 0x40F2FE7: XrmGetStringDatabase (in /usr/lib/libX11.so.6.2.0)
==2727==    by 0x40CC863: XGetDefault (in /usr/lib/libX11.so.6.2.0)
==2727==    by 0x49E337C: _XcursorGetDisplayInfo (in /usr/lib/libXcursor.so.1.0.2)
==2727==    by 0x49E35FC: XcursorSupportsARGB (in /usr/lib/libXcursor.so.1.0.2)

Points pretty clearly to xlib being the culprit.

But this one?

==2727== 72 bytes in 1 blocks are possibly lost in loss record 9 of 26
==2727==    at 0x401B6CA: calloc (vg_replace_malloc.c:279)
==2727==    by 0x400E188: (within /lib/ld-2.3.6.so)
==2727==    by 0x400E24B: _dl_allocate_tls (in /lib/ld-2.3.6.so)
==2727==    by 0x409781F: pthread_create@@GLIBC_2.1 (in /lib/tls/i686/cmov/libpthread-2.3.6.so)
==2727==    by 0x814E85D: (within /Projects/juce/extras/juce demo/build/linux/build/jucedemo)
==2727==    by 0x807BE5D: (within /Projects/juce/extras/juce demo/build/linux/build/jucedemo)
==2727==    by 0x807BFD1: (within /Projects/juce/extras/juce demo/build/linux/build/jucedemo)
==2727==    by 0x8095359: (within /Projects/juce/extras/juce demo/build/linux/build/jucedemo)
==2727==    by 0x80966CE: (within /Projects/juce/extras/juce demo/build/linux/build/jucedemo)
==2727==    by 0x814C0A9: (within /Projects/juce/extras/juce demo/build/linux/build/jucedemo)
==2727==    by 0x8096544: (within /Projects/juce/extras/juce demo/build/linux/build/jucedemo)
==2727==    by 0x8096623: (within /Projects/juce/extras/juce demo/build/linux/build/jucedemo)

(If you make a debug build with symbols you get line numbers, but I didn't)

I guess what I'm asking is in which direction one should parse this call stack. Is the likely offender at the top or the bottom?

The leaks are not tremendous in either case, but it's strange that asound and xlib are not better checked. They show up all over the place.

jules
Offline
Last seen: 4 hours 10 min ago
Joined: 29 Apr 2013 - 18:37

Looks like you're running a release build there - can't it display better symbol info about the juce bits?

Rock Hardbuns
Offline
Last seen: 3 years 1 month ago
Joined: 22 Nov 2005 - 00:10

Sure. As I noted I just had a release build laying around. Here's a debug build with symbols:

I dumped the entire log to a file, sorry if it's a bit long. But they say the later problems can be cause by the earlier ones.

EDITED: Removed it because it was just too long.. see next post.

Rock Hardbuns
Offline
Last seen: 3 years 1 month ago
Joined: 22 Nov 2005 - 00:10

EDITED. Heres a log with the conditional jump errors supressed:

==2895== Memcheck, a memory error detector.
==2895== Copyright (C) 2002-2006, and GNU GPL'd, by Julian Seward et al.
==2895== Using LibVEX rev 1658, a library for dynamic binary translation.
==2895== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP.
==2895== Using valgrind-3.2.1-Debian, a dynamic binary instrumentation framework.
==2895== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et al.
==2895== For more details, rerun with: -v
==2895== 
==2895== Syscall param write(buf) points to uninitialised byte(s)
==2895==    at 0x4000792: (within /lib/ld-2.3.6.so)
==2895==    by 0x40E729E: _X11TransWrite (in /usr/lib/libX11.so.6.2.0)
==2895==    by 0x40ECBD5: (within /usr/lib/libX11.so.6.2.0)
==2895==    by 0x40C9500: XFlush (in /usr/lib/libX11.so.6.2.0)
==2895==    by 0x817B98F: juce::juce_postMessageToSystemQueue(void*) (juce_linux_Messaging.cpp:262)
==2895==    by 0x80A485F: juce::MessageManager::postMessageToQueue(juce::Message*) (juce_MessageManager.cpp:94)
==2895==    by 0x80A57B9: juce::MessageListener::postMessage(juce::Message*) const (juce_MessageListener.cpp:62)
==2895==    by 0x80A3ED8: juce::AsyncUpdater::triggerAsyncUpdate() (juce_AsyncUpdater.cpp:55)
==2895==    by 0x80A28C1: juce::InternalTimerThread::InternalTimerThread() (juce_Timer.cpp:171)
==2895==    by 0x80A3138: juce::InternalTimerThread::add(juce::Timer*) (juce_Timer.cpp:280)
==2895==    by 0x80A2182: juce::Timer::startTimer(int) (juce_Timer.cpp:366)
==2895==    by 0x80A4589: juce::MessageManager::setTimeBeforeShowingWaitCursor(int) (juce_MessageManager.cpp:302)
==2895==  Address 0x44D777A is 50 bytes inside a block of size 16,384 alloc'd
==2895==    at 0x401B6CA: calloc (vg_replace_malloc.c:279)
==2895==    by 0x40D7CBD: XOpenDisplay (in /usr/lib/libX11.so.6.2.0)
==2895==    by 0x817BD44: juce::MessageManager::doPlatformSpecificInitialisation() (juce_linux_Messaging.cpp:196)
==2895==    by 0x80A5408: juce::MessageManager::getInstance() (juce_MessageManager.cpp:84)
==2895==    by 0x808637F: juce::initialiseJuce_GUI() (juce_Application.cpp:312)
==2895==    by 0x80866A9: juce::JUCEApplication::main(juce::String&, juce::JUCEApplication*) (juce_Application.cpp:178)
==2895==    by 0x8086C42: juce::JUCEApplication::main(int, char**, juce::JUCEApplication*) (juce_Application.cpp:297)
==2895==    by 0x8050D30: main (ApplicationStartup.cpp:178)
==2895== 
==2895== Syscall param write(buf) points to uninitialised byte(s)
==2895==    at 0x4000792: (within /lib/ld-2.3.6.so)
==2895==    by 0x40E729E: _X11TransWrite (in /usr/lib/libX11.so.6.2.0)
==2895==    by 0x40ECBD5: (within /usr/lib/libX11.so.6.2.0)
==2895==    by 0x40ECCAA: _XReply (in /usr/lib/libX11.so.6.2.0)
==2895==    by 0x40D2F70: XInternAtom (in /usr/lib/libX11.so.6.2.0)
==2895==    by 0x8180E94: juce::LinuxComponentPeer::removeWindowDecorations(unsigned long) (juce_linux_Windowing.cpp:1763)
==2895==    by 0x8185C64: juce::LinuxComponentPeer::createWindow() (juce_linux_Windowing.cpp:2020)
==2895==    by 0x818601E: juce::LinuxComponentPeer::LinuxComponentPeer(juce::Component*, int) (juce_linux_Windowing.cpp:682)
==2895==    by 0x8180580: juce::Component::createNewPeer(int, void*) (juce_linux_Windowing.cpp:2404)
==2895==    by 0x80F89D3: juce::Component::addToDesktop(int, void*) (juce_Component.cpp:494)
==2895==    by 0x817105B: juce::TopLevelWindow::TopLevelWindow(juce::String const&, bool) (juce_TopLevelWindow.cpp:161)
==2895==    by 0x816D954: juce::ResizableWindow::ResizableWindow(juce::String const&, juce::Colour const&, bool) (juce_ResizableWindow.cpp:55)
==2895==  Address 0x44D7791 is 73 bytes inside a block of size 16,384 alloc'd
==2895==    at 0x401B6CA: calloc (vg_replace_malloc.c:279)
==2895==    by 0x40D7CBD: XOpenDisplay (in /usr/lib/libX11.so.6.2.0)
==2895==    by 0x817BD44: juce::MessageManager::doPlatformSpecificInitialisation() (juce_linux_Messaging.cpp:196)
==2895==    by 0x80A5408: juce::MessageManager::getInstance() (juce_MessageManager.cpp:84)
==2895==    by 0x808637F: juce::initialiseJuce_GUI() (juce_Application.cpp:312)
==2895==    by 0x80866A9: juce::JUCEApplication::main(juce::String&, juce::JUCEApplication*) (juce_Application.cpp:178)
==2895==    by 0x8086C42: juce::JUCEApplication::main(int, char**, juce::JUCEApplication*) (juce_Application.cpp:297)
==2895==    by 0x8050D30: main (ApplicationStartup.cpp:178)
 
==2895== Thread 2:
==2895== Invalid read of size 4
==2895==    at 0x4010E00: (within /lib/ld-2.3.6.so)
==2895==    by 0x4004B78: (within /lib/ld-2.3.6.so)
==2895==    by 0x4006792: (within /lib/ld-2.3.6.so)
==2895==    by 0x447336F: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==2895==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==2895==    by 0x4472DDE: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
==2895==    by 0x44A4D8D: (within /lib/tls/i686/cmov/libdl-2.3.6.so)
==2895==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==2895==    by 0x44A542C: (within /lib/tls/i686/cmov/libdl-2.3.6.so)
==2895==    by 0x44A4D20: dlopen (in /lib/tls/i686/cmov/libdl-2.3.6.so)
==2895==    by 0x40C6448: (within /usr/lib/libX11.so.6.2.0)
==2895==    by 0x40C690F: XCreateGlyphCursor (in /usr/lib/libX11.so.6.2.0)
==2895==  Address 0x5216988 is 24 bytes inside a block of size 25 alloc'd
==2895==    at 0x401C38B: malloc (vg_replace_malloc.c:149)
==2895==    by 0x4006B83: (within /lib/ld-2.3.6.so)
==2895==    by 0x447336F: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==2895==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==2895==    by 0x4472DDE: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
==2895==    by 0x44A4D8D: (within /lib/tls/i686/cmov/libdl-2.3.6.so)
==2895==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==2895==    by 0x44A542C: (within /lib/tls/i686/cmov/libdl-2.3.6.so)
==2895==    by 0x44A4D20: dlopen (in /lib/tls/i686/cmov/libdl-2.3.6.so)
==2895==    by 0x40C6448: (within /usr/lib/libX11.so.6.2.0)
==2895==    by 0x40C690F: XCreateGlyphCursor (in /usr/lib/libX11.so.6.2.0)
==2895==    by 0x40C6CAC: XCreateFontCursor (in /usr/lib/libX11.so.6.2.0)
==2895== 
==2895== Invalid read of size 4
==2895==    at 0x4010E00: (within /lib/ld-2.3.6.so)
==2895==    by 0x4004B78: (within /lib/ld-2.3.6.so)
==2895==    by 0x4006792: (within /lib/ld-2.3.6.so)
==2895==    by 0x400A1F6: (within /lib/ld-2.3.6.so)
==2895==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==2895==    by 0x400A3CA: (within /lib/ld-2.3.6.so)
==2895==    by 0x44733D4: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==2895==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==2895==    by 0x4472DDE: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
==2895==    by 0x44A4D8D: (within /lib/tls/i686/cmov/libdl-2.3.6.so)
==2895==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==2895==    by 0x44A542C: (within /lib/tls/i686/cmov/libdl-2.3.6.so)
==2895==  Address 0x49F9A88 is 24 bytes inside a block of size 25 alloc'd
==2895==    at 0x401C38B: malloc (vg_replace_malloc.c:149)
==2895==    by 0x4006B83: (within /lib/ld-2.3.6.so)
==2895==    by 0x400A1F6: (within /lib/ld-2.3.6.so)
==2895==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==2895==    by 0x400A3CA: (within /lib/ld-2.3.6.so)
==2895==    by 0x44733D4: (within /lib/tls/i686/cmov/libc-2.3.6.so)
==2895==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==2895==    by 0x4472DDE: _dl_open (in /lib/tls/i686/cmov/libc-2.3.6.so)
==2895==    by 0x44A4D8D: (within /lib/tls/i686/cmov/libdl-2.3.6.so)
==2895==    by 0x400B44E: (within /lib/ld-2.3.6.so)
==2895==    by 0x44A542C: (within /lib/tls/i686/cmov/libdl-2.3.6.so)
==2895==    by 0x44A4D20: dlopen (in /lib/tls/i686/cmov/libdl-2.3.6.so)

==2895== Syscall param write(buf) points to uninitialised byte(s)
==2895==    at 0x4000792: (within /lib/ld-2.3.6.so)
==2895==    by 0x40E729E: _X11TransWrite (in /usr/lib/libX11.so.6.2.0)
==2895==    by 0x40ECBD5: (within /usr/lib/libX11.so.6.2.0)
==2895==    by 0x40ED812: _XReadEvents (in /usr/lib/libX11.so.6.2.0)
==2895==    by 0x40D70C9: XNextEvent (in /usr/lib/libX11.so.6.2.0)
==2895==    by 0x817B746: juce::juce_dispatchNextMessageOnSystemQueue(bool) (juce_linux_Messaging.cpp:337)
==2895==    by 0x80A4A44: juce::MessageManager::dispatchNextMessage(bool, bool*) (juce_MessageManager.cpp:150)
==2895==    by 0x80A4BA9: juce::MessageManager::runDispatchLoop() (juce_MessageManager.cpp:194)
==2895==    by 0x8086A02: juce::JUCEApplication::main(juce::String&, juce::JUCEApplication*) (juce_Application.cpp:217)
==2895==    by 0x8086C42: juce::JUCEApplication::main(int, char**, juce::JUCEApplication*) (juce_Application.cpp:297)
==2895==    by 0x8050D30: main (ApplicationStartup.cpp:178)
==2895==  Address 0x44D7767 is 31 bytes inside a block of size 16,384 alloc'd
==2895==    at 0x401B6CA: calloc (vg_replace_malloc.c:279)
==2895==    by 0x40D7CBD: XOpenDisplay (in /usr/lib/libX11.so.6.2.0)
==2895==    by 0x817BD44: juce::MessageManager::doPlatformSpecificInitialisation() (juce_linux_Messaging.cpp:196)
==2895==    by 0x80A5408: juce::MessageManager::getInstance() (juce_MessageManager.cpp:84)
==2895==    by 0x808637F: juce::initialiseJuce_GUI() (juce_Application.cpp:312)
==2895==    by 0x80866A9: juce::JUCEApplication::main(juce::String&, juce::JUCEApplication*) (juce_Application.cpp:178)
==2895==    by 0x8086C42: juce::JUCEApplication::main(int, char**, juce::JUCEApplication*) (juce_Application.cpp:297)
==2895==    by 0x8050D30: main (ApplicationStartup.cpp:178)


==2895== Syscall param ioctl(arg) contains uninitialised byte(s)
==2895==    at 0x4000792: (within /lib/ld-2.3.6.so)
==2895==    by 0x41E0381: snd_pcm_prepare (in /usr/lib/libasound.so.2.0.0)
==2895==    by 0x41E6B6C: snd_pcm_hw_params (in /usr/lib/libasound.so.2.0.0)
==2895==    by 0x81CF9F5: juce::ALSADevice::setParameters(unsigned, int, int) (juce_linux_Audio.cpp:211)
==2895==    by 0x81CFED7: juce::ALSAThread::open(juce::BitArray const&, juce::BitArray const&, double, int) (juce_linux_Audio.cpp:431)
==2895==    by 0x81D032D: juce::ALSAAudioIODevice::open(juce::BitArray const&, juce::BitArray const&, double, int) (juce_linux_Audio.cpp:735)
==2895==    by 0x809C3E2: juce::AudioDeviceManager::restartDevice(int, double, juce::BitArray const&, juce::BitArray const&) (juce_AudioDeviceManager.cpp:343)
==2895==    by 0x809CB63: juce::AudioDeviceManager::setAudioDevice(juce::String const&, int, double, juce::BitArray const*, juce::BitArray const*, bool) (juce_AudioDeviceManager.cpp:249)
==2895==    by 0x809D6E3: juce::AudioDeviceManager::initialise(int, int, juce::XmlElement const*, bool) (juce_AudioDeviceManager.cpp:114)
==2895==    by 0x80667BB: AudioDemo::AudioDemo() (AudioDemo.cpp:455)
==2895==    by 0x8063E30: createAudioDemo() (AudioDemo.cpp:639)
==2895==    by 0x804F428: ContentComp::perform(juce::ApplicationCommandTarget::InvocationInfo const&) (MainDemoWindow.cpp:427)
==2895== 
==2895== Syscall param ioctl(generic) points to unaddressable byte(s)
==2895==    at 0x4000792: (within /lib/ld-2.3.6.so)
==2895==    by 0x41DF8FF: snd_pcm_link (in /usr/lib/libasound.so.2.0.0)
==2895==    by 0x81D0132: juce::ALSAThread::open(juce::BitArray const&, juce::BitArray const&, double, int) (juce_linux_Audio.cpp:466)
==2895==    by 0x81D032D: juce::ALSAAudioIODevice::open(juce::BitArray const&, juce::BitArray const&, double, int) (juce_linux_Audio.cpp:735)
==2895==    by 0x809C3E2: juce::AudioDeviceManager::restartDevice(int, double, juce::BitArray const&, juce::BitArray const&) (juce_AudioDeviceManager.cpp:343)
==2895==    by 0x809CB63: juce::AudioDeviceManager::setAudioDevice(juce::String const&, int, double, juce::BitArray const*, juce::BitArray const*, bool) (juce_AudioDeviceManager.cpp:249)
==2895==    by 0x809D6E3: juce::AudioDeviceManager::initialise(int, int, juce::XmlElement const*, bool) (juce_AudioDeviceManager.cpp:114)
==2895==    by 0x80667BB: AudioDemo::AudioDemo() (AudioDemo.cpp:455)
==2895==    by 0x8063E30: createAudioDemo() (AudioDemo.cpp:639)
==2895==    by 0x804F428: ContentComp::perform(juce::ApplicationCommandTarget::InvocationInfo const&) (MainDemoWindow.cpp:427)
==2895==    by 0x8087ABB: juce::ApplicationCommandTarget::tryToInvoke(juce::ApplicationCommandTarget::InvocationInfo const&, bool) (juce_ApplicationCommandTarget.cpp:66)
==2895==    by 0x8087B35: juce::ApplicationCommandTarget::CommandTargetMessageInvoker::handleMessage(juce::Message const&) (juce_ApplicationCommandTarget.cpp:203)
==2895==  Address 0x6 is not stack'd, malloc'd or (recently) free'd
==2895== 
==2895== Syscall param ioctl(arg) contains uninitialised byte(s)
==2895==    at 0x4000792: (within /lib/ld-2.3.6.so)
==2895==    by 0x41E0381: snd_pcm_prepare (in /usr/lib/libasound.so.2.0.0)
==2895==    by 0x81D0152: juce::ALSAThread::open(juce::BitArray const&, juce::BitArray const&, double, int) (juce_linux_Audio.cpp:469)
==2895==    by 0x81D032D: juce::ALSAAudioIODevice::open(juce::BitArray const&, juce::BitArray const&, double, int) (juce_linux_Audio.cpp:735)
==2895==    by 0x809C3E2: juce::AudioDeviceManager::restartDevice(int, double, juce::BitArray const&, juce::BitArray const&) (juce_AudioDeviceManager.cpp:343)
==2895==    by 0x809CB63: juce::AudioDeviceManager::setAudioDevice(juce::String const&, int, double, juce::BitArray const*, juce::BitArray const*, bool) (juce_AudioDeviceManager.cpp:249)
==2895==    by 0x809D6E3: juce::AudioDeviceManager::initialise(int, int, juce::XmlElement const*, bool) (juce_AudioDeviceManager.cpp:114)
==2895==    by 0x80667BB: AudioDemo::AudioDemo() (AudioDemo.cpp:455)
==2895==    by 0x8063E30: createAudioDemo() (AudioDemo.cpp:639)
==2895==    by 0x804F428: ContentComp::perform(juce::ApplicationCommandTarget::InvocationInfo const&) (MainDemoWindow.cpp:427)
==2895==    by 0x8087ABB: juce::ApplicationCommandTarget::tryToInvoke(juce::ApplicationCommandTarget::InvocationInfo const&, bool) (juce_ApplicationCommandTarget.cpp:66)
==2895==    by 0x8087B35: juce::ApplicationCommandTarget::CommandTargetMessageInvoker::handleMessage(juce::Message const&) (juce_ApplicationCommandTarget.cpp:203)
==2895== 
==2895== Syscall param ioctl(arg) contains uninitialised byte(s)
==2895==    at 0x4000792: (within /lib/ld-2.3.6.so)
==2895==    by 0x41E0381: snd_pcm_prepare (in /usr/lib/libasound.so.2.0.0)
==2895==    by 0x81D019D: juce::ALSAThread::open(juce::BitArray const&, juce::BitArray const&, double, int) (juce_linux_Audio.cpp:472)
==2895==    by 0x81D032D: juce::ALSAAudioIODevice::open(juce::BitArray const&, juce::BitArray const&, double, int) (juce_linux_Audio.cpp:735)
==2895==    by 0x809C3E2: juce::AudioDeviceManager::restartDevice(int, double, juce::BitArray const&, juce::BitArray const&) (juce_AudioDeviceManager.cpp:343)
==2895==    by 0x809CB63: juce::AudioDeviceManager::setAudioDevice(juce::String const&, int, double, juce::BitArray const*, juce::BitArray const*, bool) (juce_AudioDeviceManager.cpp:249)
==2895==    by 0x809D6E3: juce::AudioDeviceManager::initialise(int, int, juce::XmlElement const*, bool) (juce_AudioDeviceManager.cpp:114)
==2895==    by 0x80667BB: AudioDemo::AudioDemo() (AudioDemo.cpp:455)
==2895==    by 0x8063E30: createAudioDemo() (AudioDemo.cpp:639)
==2895==    by 0x804F428: ContentComp::perform(juce::ApplicationCommandTarget::InvocationInfo const&) (MainDemoWindow.cpp:427)
==2895==    by 0x8087ABB: juce::ApplicationCommandTarget::tryToInvoke(juce::ApplicationCommandTarget::InvocationInfo const&, bool) (juce_ApplicationCommandTarget.cpp:66)
==2895==    by 0x8087B35: juce::ApplicationCommandTarget::CommandTargetMessageInvoker::handleMessage(juce::Message const&) (juce_ApplicationCommandTarget.cpp:203)
==2895== 
==2895== Syscall param ioctl(arg) contains uninitialised byte(s)
==2895==    at 0x4000792: (within /lib/ld-2.3.6.so)
==2895==    by 0x41E01A1: snd_pcm_drop (in /usr/lib/libasound.so.2.0.0)
==2895==    by 0x41E76E4: snd_pcm_close (in /usr/lib/libasound.so.2.0.0)
==2895==    by 0x81CF1B8: juce::ALSADevice::~ALSADevice() (juce_linux_Audio.cpp:156)
==2895==    by 0x81CF261: juce::ALSAThread::close() (juce_linux_Audio.cpp:495)
==2895==    by 0x81D03D9: juce::ALSAThread::~ALSAThread() (juce_linux_Audio.cpp:377)
==2895==    by 0x81CEFB2: juce::ALSAAudioIODevice::~ALSAAudioIODevice() (juce_linux_Audio.cpp:667)
==2895==    by 0x809D9E5: juce::AudioDeviceManager::~AudioDeviceManager() (juce_AudioDeviceManager.cpp:63)
==2895==    by 0x8064DFA: AudioDemo::~AudioDemo() (AudioDemo.cpp:493)
==2895==    by 0x804EE12: ContentComp::showDemo(juce::Component*, char const*) (MainDemoWindow.cpp:161)
==2895==    by 0x804F49B: ContentComp::perform(juce::ApplicationCommandTarget::InvocationInfo const&) (MainDemoWindow.cpp:451)
==2895==    by 0x8087ABB: juce::ApplicationCommandTarget::tryToInvoke(juce::ApplicationCommandTarget::InvocationInfo const&, bool) (juce_ApplicationCommandTarget.cpp:66)
==2895== 
==2895== Syscall param ioctl(arg) contains uninitialised byte(s)
==2895==    at 0x4000792: (within /lib/ld-2.3.6.so)
==2895==    by 0x41E6B0C: snd_pcm_hw_free (in /usr/lib/libasound.so.2.0.0)
==2895==    by 0x41E76EC: snd_pcm_close (in /usr/lib/libasound.so.2.0.0)
==2895==    by 0x81CF1B8: juce::ALSADevice::~ALSADevice() (juce_linux_Audio.cpp:156)
==2895==    by 0x81CF261: juce::ALSAThread::close() (juce_linux_Audio.cpp:495)
==2895==    by 0x81D03D9: juce::ALSAThread::~ALSAThread() (juce_linux_Audio.cpp:377)
==2895==    by 0x81CEFB2: juce::ALSAAudioIODevice::~ALSAAudioIODevice() (juce_linux_Audio.cpp:667)
==2895==    by 0x809D9E5: juce::AudioDeviceManager::~AudioDeviceManager() (juce_AudioDeviceManager.cpp:63)
==2895==    by 0x8064DFA: AudioDemo::~AudioDemo() (AudioDemo.cpp:493)
==2895==    by 0x804EE12: ContentComp::showDemo(juce::Component*, char const*) (MainDemoWindow.cpp:161)
==2895==    by 0x804F49B: ContentComp::perform(juce::ApplicationCommandTarget::InvocationInfo const&) (MainDemoWindow.cpp:451)
==2895==    by 0x8087ABB: juce::ApplicationCommandTarget::tryToInvoke(juce::ApplicationCommandTarget::InvocationInfo const&, bool) (juce_ApplicationCommandTarget.cpp:66)
==2895== 
==2895== More than 100 errors detected.  Subsequent errors
==2895== will still be recorded, but in less detail than before.
==2895== 
==2895== ERROR SUMMARY: 305350 errors from 100 contexts (suppressed: 39 from 1)
==2895== malloc/free: in use at exit: 42,529 bytes in 1,439 blocks.
==2895== malloc/free: 328,135 allocs, 326,696 frees, 126,428,337 bytes allocated.
==2895== For counts of detected errors, rerun with: -v
==2895== searching for pointers to 1,439 not-freed blocks.
==2895== checked 33,794,988 bytes.
==2895== 
==2895== 
==2895== 40 bytes in 2 blocks are possibly lost in loss record 10 of 34
==2895==    at 0x401C38B: malloc (vg_replace_malloc.c:149)
==2895==    by 0x41C63D7: snd_dlobj_cache_add (in /usr/lib/libasound.so.2.0.0)
==2895==    by 0x41E605A: (within /usr/lib/libasound.so.2.0.0)
==2895==    by 0x41E6687: (within /usr/lib/libasound.so.2.0.0)
==2895==    by 0x81CEBCB: juce::getDeviceProperties(juce::String const&, unsigned&, unsigned&, unsigned&, unsigned&, juce::Array<int, juce::DummyCriticalSection>&) (juce_linux_Audio.cpp:107)
==2895==    by 0x81D146A: juce::ALSAAudioIODeviceType::testDevice(juce::String const&) (juce_linux_Audio.cpp:926)
==2895==    by 0x81D1AB6: juce::ALSAAudioIODeviceType::scanForDevices() (juce_linux_Audio.cpp:863)
==2895==    by 0x809B8DE: juce::AudioDeviceManager::refreshDeviceList() const (juce_AudioDeviceManager.cpp:145)
==2895==    by 0x809D25C: juce::AudioDeviceManager::initialise(int, int, juce::XmlElement const*, bool) (juce_AudioDeviceManager.cpp:75)
==2895==    by 0x80667BB: AudioDemo::AudioDemo() (AudioDemo.cpp:455)
==2895==    by 0x8063E30: createAudioDemo() (AudioDemo.cpp:639)
==2895==    by 0x804F428: ContentComp::perform(juce::ApplicationCommandTarget::InvocationInfo const&) (MainDemoWindow.cpp:427)
==2895== 
==2895== 
==2895== 112 (8 direct, 104 indirect) bytes in 1 blocks are definitely lost in loss record 15 of 34
==2895==    at 0x401C487: realloc (vg_replace_malloc.c:306)
==2895==    by 0x40FE4D3: (within /usr/lib/libX11.so.6.2.0)
==2895==    by 0x40FEF3B: (within /usr/lib/libX11.so.6.2.0)
==2895==    by 0x4100C97: _XlcCreateLC (in /usr/lib/libX11.so.6.2.0)
==2895==    by 0x411EEAA: _XlcDefaultLoader (in /usr/lib/libX11.so.6.2.0)
==2895==    by 0x41077AE: _XOpenLC (in /usr/lib/libX11.so.6.2.0)
==2895==    by 0x410789D: _XrmInitParseInfo (in /usr/lib/libX11.so.6.2.0)
==2895==    by 0x40F14C0: (within /usr/lib/libX11.so.6.2.0)
==2895==    by 0x40F2FE7: XrmGetStringDatabase (in /usr/lib/libX11.so.6.2.0)
==2895==    by 0x40CC863: XGetDefault (in /usr/lib/libX11.so.6.2.0)
==2895==    by 0x530737C: _XcursorGetDisplayInfo (in /usr/lib/libXcursor.so.1.0.2)
==2895==    by 0x53075FC: XcursorSupportsARGB (in /usr/lib/libXcursor.so.1.0.2)
==2895== 
==2895== 
==2895== 212 bytes in 30 blocks are definitely lost in loss record 19 of 34
==2895==    at 0x401C38B: malloc (vg_replace_malloc.c:149)
==2895==    by 0x40E3FA1: XStringListToTextProperty (in /usr/lib/libX11.so.6.2.0)
==2895==    by 0x818544E: juce::LinuxComponentPeer::setWindowTitle(unsigned long, char const*) (juce_linux_Windowing.cpp:2114)
==2895==    by 0x8185F02: juce::LinuxComponentPeer::setTitle(juce::String const&) (juce_linux_Windowing.cpp:729)
==2895==    by 0x8186050: juce::LinuxComponentPeer::LinuxComponentPeer(juce::Component*, int) (juce_linux_Windowing.cpp:684)
==2895==    by 0x8180580: juce::Component::createNewPeer(int, void*) (juce_linux_Windowing.cpp:2404)
==2895==    by 0x80F89D3: juce::Component::addToDesktop(int, void*) (juce_Component.cpp:494)
==2895==    by 0x8158B7D: juce::PopupMenuWindow::create(juce::PopupMenu const&, bool, juce::PopupMenuWindow*, int, int, int, int, int, int, int, bool, int, juce::Component*, juce::ApplicationCommandManager**, juce::Component*) (juce_PopupMenu.cpp:420)
==2895==    by 0x8155016: juce::PopupMenu::createMenuComponent(int, int, int, int, int, int, int, int, bool, juce::Component*, juce::ApplicationCommandManager**, juce::Component*) (juce_PopupMenu.cpp:1570)
==2895==    by 0x81CD3AE: juce::MenuBarComponent::showMenu(int) (juce_MenuBarComponent.cpp:234)
==2895==    by 0x81CDA00: juce::MenuBarComponent::mouseDown(juce::MouseEvent const&) (juce_MenuBarComponent.cpp:341)
==2895==    by 0x80F6C41: juce::Component::internalMouseDown(int, int) (juce_Component.cpp:2558)
==2895== 
==2895== 
==2895== 288 bytes in 4 blocks are possibly lost in loss record 21 of 34
==2895==    at 0x401B6CA: calloc (vg_replace_malloc.c:279)
==2895==    by 0x400E188: (within /lib/ld-2.3.6.so)
==2895==    by 0x400E24B: _dl_allocate_tls (in /lib/ld-2.3.6.so)
==2895==    by 0x409781F: pthread_create@@GLIBC_2.1 (in /lib/tls/i686/cmov/libpthread-2.3.6.so)
==2895==    by 0x817EAA0: juce::juce_createThread(void*) (juce_linux_Threads.cpp:67)
==2895==    by 0x80847E8: juce::Thread::startThread() (juce_Thread.cpp:117)
==2895==    by 0x8084888: juce::Thread::startThread(int) (juce_Thread.cpp:130)
==2895==    by 0x8067CD5: DemoThread::DemoThread() (ThreadingDemo.cpp:151)
==2895==    by 0x8067DF9: ThreadingDemo::addABall() (ThreadingDemo.cpp:291)
==2895==    by 0x806873B: ThreadingDemo::parentHierarchyChanged() (ThreadingDemo.cpp:262)
==2895==    by 0x80F2F7C: juce::Component::internalHierarchyChanged() (juce_Component.cpp:1385)
==2895==    by 0x80F866C: juce::Component::addChildComponent(juce::Component*, int) (juce_Component.cpp:1229)
==2895== 
==2895== 
==2895== 9,720 bytes in 270 blocks are possibly lost in loss record 34 of 34
==2895==    at 0x401B6CA: calloc (vg_replace_malloc.c:279)
==2895==    by 0x41BCE99: (within /usr/lib/libasound.so.2.0.0)
==2895==    by 0x41BCFC0: (within /usr/lib/libasound.so.2.0.0)
==2895==    by 0x41BF038: (within /usr/lib/libasound.so.2.0.0)
==2895==    by 0x41BF26E: (within /usr/lib/libasound.so.2.0.0)
==2895==    by 0x41BF5CC: (within /usr/lib/libasound.so.2.0.0)
==2895==    by 0x41BF835: (within /usr/lib/libasound.so.2.0.0)
==2895==    by 0x41BF8F1: (within /usr/lib/libasound.so.2.0.0)
==2895==    by 0x41C1A41: snd_config_update_r (in /usr/lib/libasound.so.2.0.0)
==2895==    by 0x41C20F5: snd_config_update (in /usr/lib/libasound.so.2.0.0)
==2895==    by 0x41CDD72: snd_ctl_open (in /usr/lib/libasound.so.2.0.0)
==2895==    by 0x81D1921: juce::ALSAAudioIODeviceType::scanForDevices() (juce_linux_Audio.cpp:844)
==2895== 
==2895== LEAK SUMMARY:
==2895==    definitely lost: 220 bytes in 31 blocks.
==2895==    indirectly lost: 104 bytes in 4 blocks.
==2895==      possibly lost: 10,048 bytes in 276 blocks.
==2895==    still reachable: 32,157 bytes in 1,128 blocks.
==2895==         suppressed: 0 bytes in 0 blocks.
==2895== Reachable blocks (those to which a pointer was found) are not shown.
==2895== To see them, rerun with: --show-reachable=yes

..for your parsing pleasure.

Rock Hardbuns
Offline
Last seen: 3 years 1 month ago
Joined: 22 Nov 2005 - 00:10

Many of these are "Conditional jump or move depends on uninitialised value(s) " which I should probably have edited out because normally it's pretty harmless, like so:

if (MyVar != myValue){ MyVar = myValue; }

kraken
kraken's picture
Offline
Last seen: 3 hours 21 min ago
Joined: 9 Feb 2005 - 09:31

also, if you look better the most (and not all are "definately" but only "possibly") leaking bits are the alsa ones...

Rock Hardbuns
Offline
Last seen: 3 years 1 month ago
Joined: 22 Nov 2005 - 00:10

Well, it sort of makes sense for alsa/asound to generate some "possibly lost" errors given all the buffer shuffling between contexts and so forth.

Xlib seems to be the worst offender. But what I'm actually wondering is if these errors originate with the client program and just cascade back to the underlaying API, or the other way around.

jules
Offline
Last seen: 4 hours 10 min ago
Joined: 29 Apr 2013 - 18:37

Very interesting.

Going through it I've found a few bits of code that I've tidied-up, but none of them were actually what you'd call a bug. Some of the stuff in there is just nonsense (no idea why it's showing errors in the Path::addCubic method). And some of it looks like Xlib messing up. Good stuff, I might have a go of it myself.

kraken
kraken's picture
Offline
Last seen: 3 hours 21 min ago
Joined: 9 Feb 2005 - 09:31

i think they will originate in some underlying library...
i don't see any juce > system calls leaking but juce > lib > system instead.
anyway, that output could be a start to go under the hood and check if something is done badly in the current implementation (or if those leaking bits can be avoided in some way).

Rock Hardbuns
Offline
Last seen: 3 years 1 month ago
Joined: 22 Nov 2005 - 00:10

Yeah, the top call is the one that triggers the error, but not necessarily the cause of it. As far as I can tell.

The profiling tools in valgrind are fun too. I could easily spend a weekend just messing with this thing.

kraken
kraken's picture
Offline
Last seen: 3 hours 21 min ago
Joined: 9 Feb 2005 - 09:31

yeah valgrind is quite fun.
anyway last time i've tried running some audio applications through it i've locked some x windows without the ability to force close them, and only a killall -9 on a different tty was possible :D

anyway i've found another interesting bit using it (that could be directly related to juce, nothing too problematic anyway):

==26158== Source and destination overlap in memcpy(0x4BE52F8, 0x4BE52F9, 21)
==26158== at 0x4022806: memcpy (in /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==26158== by 0x818C567: juce::BufferedInputStream::ensureBuffered() (juce_BufferedInputStream.cpp:103)
==26158== by 0x818C75F: juce::BufferedInputStream::read(void*, int) (juce_BufferedInputStream.cpp:143)
==26158== by 0x80A6452: juce::ZipFile::findEndOfZipEntryTable() (juce_ZipFile.cpp:308)
==26158== by 0x80A5FFB: juce::ZipFile::init() (juce_ZipFile.cpp:232)
==26158== by 0x80A5A88: juce::ZipFile::ZipFile(juce::InputStream*, bool) (juce_ZipFile.cpp:138)
==26158== by 0x807D27F: ToolbarMainItemFactory::createButtonFromZipFile(int, juce::String const&, juce::String const&, int) (ToolbarMainComponent.cpp:180)
==26158== by 0x807CEF4: ToolbarMainItemFactory::createItem(int) (ToolbarMainComponent.cpp:144)
==26158== by 0x812BCCD: juce::Toolbar::createItem(juce::ToolbarItemFactory&, int) (juce_Toolbar.cpp:322)
==26158== by 0x812BD1E: juce::Toolbar::addItemInternal(juce::ToolbarItemFactory&, int, int) (juce_Toolbar.cpp:332)
==26158== by 0x812C1F0: juce::Toolbar::restoreFromString(juce::ToolbarItemFactory&, juce::String const&) (juce_Toolbar.cpp:448)
==26158== by 0x807D72C: ToolbarMainComponent::ToolbarMainComponent(HostFilterComponent*) (ToolbarMainComponent.cpp:220)

Pages