I just wondered what valgrind (http://valgrind.org/) will do if I let it check a simple PB GUI program. But is this ok???
PB 5.42 LTS on Kubuntu 14.04 (amd64):
Code: Select all
CompilerIf #PB_Compiler_Unicode
#XmlEncoding = #PB_UTF8
CompilerElse
#XmlEncoding = #PB_Ascii
CompilerEndIf
Procedure main()
Protected XML.s, Event.i, evType.i, evGadget.i
XML = "<window id='#PB_Any' name='mainWin' text='Test' flags='#PB_Window_ScreenCentered | #PB_Window_SystemMenu | #PB_Window_SizeGadget'>" +
" <vbox expand='item:1'>" +
" <hbox expand='item:1'>" +
" <canvas name='draw' width='300' height='120'/>" +
" <vbox expand='item:2'>" +
" <button name='clear' text='clear' />" +
" <empty />" +
" </vbox>" +
" </hbox>" +
" <gridbox columns='2' colexpand='item:2'>" +
" <text text='Device:' name='lblDevice' flags='#PB_Text_Right'/>" +
" <combobox name='device' />" +
" </gridbox>" +
" </vbox>" +
"</window>"
Protected xm.i = CatchXML(#PB_Any, @XML, StringByteLength(XML), 0, #XmlEncoding)
Protected dialog.i = CreateDialog(#PB_Any)
If OpenXMLDialog(dialog.i, xm.i, "mainWin") = 0
Debug "Dialog error: " + DialogError(dialog.i): ProcedureReturn 0
EndIf
Repeat
Event = WaitWindowEvent(10)
If Event = #PB_Event_Gadget
evType.i = EventType()
evGadget.i = EventGadget()
EndIf
Until Event = #PB_Event_CloseWindow
EndProcedure
main()
Code: Select all
Thousands of
==26360== Conditional jump or move depends on uninitialised value(s)
==26360== at 0x56BE651: ??? (in /usr/lib/x86_64-linux-gnu/libcairo.so.2.11301.0)
==26360== by 0x56BEB54: ??? (in /usr/lib/x86_64-linux-gnu/libcairo.so.2.11301.0)
==26360== by 0x568FF4D: ??? (in /usr/lib/x86_64-linux-gnu/libcairo.so.2.11301.0)
==26360== by 0x56900F2: ??? (in /usr/lib/x86_64-linux-gnu/libcairo.so.2.11301.0)
==26360== by 0x5688127: ??? (in /usr/lib/x86_64-linux-gnu/libcairo.so.2.11301.0)
==26360== by 0x5691147: ??? (in /usr/lib/x86_64-linux-gnu/libcairo.so.2.11301.0)
==26360== by 0x56C2DC1: ??? (in /usr/lib/x86_64-linux-gnu/libcairo.so.2.11301.0)
==26360== by 0x566BA63: ??? (in /usr/lib/x86_64-linux-gnu/libcairo.so.2.11301.0)
==26360== by 0x56DCA3C: ??? (in /usr/lib/x86_64-linux-gnu/libcairo.so.2.11301.0)
==26360== by 0x56B0411: ??? (in /usr/lib/x86_64-linux-gnu/libcairo.so.2.11301.0)
==26360== by 0x56B4DF4: ??? (in /usr/lib/x86_64-linux-gnu/libcairo.so.2.11301.0)
==26360== by 0x56B5A5E: ??? (in /usr/lib/x86_64-linux-gnu/libcairo.so.2.11301.0)
...
Hundreds of
==26360== Conditional jump or move depends on uninitialised value(s)
==26360== at 0x56BF3EF: ??? (in /usr/lib/x86_64-linux-gnu/libcairo.so.2.11301.0)
==26360== by 0x56C2DD8: ??? (in /usr/lib/x86_64-linux-gnu/libcairo.so.2.11301.0)
==26360== by 0x566BA63: ??? (in /usr/lib/x86_64-linux-gnu/libcairo.so.2.11301.0)
==26360== by 0x56DCA3C: ??? (in /usr/lib/x86_64-linux-gnu/libcairo.so.2.11301.0)
==26360== by 0x56B0411: ??? (in /usr/lib/x86_64-linux-gnu/libcairo.so.2.11301.0)
==26360== by 0x56B4DF4: ??? (in /usr/lib/x86_64-linux-gnu/libcairo.so.2.11301.0)
==26360== by 0x56B5A5E: ??? (in /usr/lib/x86_64-linux-gnu/libcairo.so.2.11301.0)
==26360== by 0x56B0411: ??? (in /usr/lib/x86_64-linux-gnu/libcairo.so.2.11301.0)
==26360== by 0x56731E1: ??? (in /usr/lib/x86_64-linux-gnu/libcairo.so.2.11301.0)
==26360== by 0x566D168: ??? (in /usr/lib/x86_64-linux-gnu/libcairo.so.2.11301.0)
==26360== by 0x5666994: cairo_stroke (in /usr/lib/x86_64-linux-gnu/libcairo.so.2.11301.0)
==26360== by 0xEDEAC9E: Oxygen::Style::renderArrow(_cairo*, GtkArrowType, int, int, int, int, Oxygen::QtSettings::ArrowSize, Oxygen::StyleOptions const&, Oxygen::AnimationData const&, Oxygen::Palette::Role) const (in /usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/theming-engines/liboxygen-gtk.so)
...
==26360== More than 1000 different errors detected. I'm not reporting any more.
==26360== Final error counts will be inaccurate. Go fix your program!
==26360== Rerun with --error-limit=no to disable this cutoff. Note
==26360== that errors may occur in your program without prior warning from
==26360== Valgrind, because errors are no longer being displayed.
==26360==
==26360==
==26360== HEAP SUMMARY:
==26360== in use at exit: 1,682,682 bytes in 22,555 blocks
==26360== total heap usage: 96,631 allocs, 74,076 frees, 20,106,033 bytes allocated
==26360==
==26360== LEAK SUMMARY:
==26360== definitely lost: 8,600 bytes in 24 blocks
==26360== indirectly lost: 40,080 bytes in 835 blocks
==26360== possibly lost: 102,561 bytes in 1,722 blocks
==26360== still reachable: 1,430,777 bytes in 19,275 blocks
==26360== suppressed: 0 bytes in 0 blocks
"valgrind --undef-value-errors=no ./test"
I still get this:
Code: Select all
==26898== Memcheck, a memory error detector
==26898== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==26898== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==26898== Command: ./test
==26898==
==26898== Invalid read of size 8
==26898== at 0x414CBA: ??? (in /home/volker/test)
==26898== by 0x44B517: ??? (in /home/volker/test)
==26898== by 0x414D32: ??? (in /home/volker/test)
==26898== by 0x41409C: ??? (in /home/volker/test)
==26898== by 0x10765D17: ???
==26898== by 0xD1ABF87: ???
==26898== by 0xD22EAB7: ???
==26898== Address 0xd22eba0 is 144 bytes inside a block of size 168 free'd
==26898== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==26898== by 0x4E9211: ??? (in /home/volker/test)
==26898== by 0x419147: ??? (in /home/volker/test)
==26898== by 0x4188F9: ??? (in /home/volker/test)
==26898== by 0x414CB6: ??? (in /home/volker/test)
==26898== by 0x44B517: ??? (in /home/volker/test)
==26898== by 0x414D32: ??? (in /home/volker/test)
==26898== by 0x41409C: ??? (in /home/volker/test)
==26898== by 0x10765D17: ???
==26898== by 0xD1ABF87: ???
==26898== by 0xD22EAB7: ???
==26898==
==26898== Invalid read of size 8
==26898== at 0x414CCE: ??? (in /home/volker/test)
==26898== by 0x44B517: ??? (in /home/volker/test)
==26898== by 0x414D32: ??? (in /home/volker/test)
==26898== by 0x41409C: ??? (in /home/volker/test)
==26898== by 0x10765D17: ???
==26898== by 0xD1ABF87: ???
==26898== by 0xD22EAB7: ???
==26898== Address 0xd22eba0 is 144 bytes inside a block of size 168 free'd
==26898== at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==26898== by 0x4E9211: ??? (in /home/volker/test)
==26898== by 0x419147: ??? (in /home/volker/test)
==26898== by 0x4188F9: ??? (in /home/volker/test)
==26898== by 0x414CB6: ??? (in /home/volker/test)
==26898== by 0x44B517: ??? (in /home/volker/test)
==26898== by 0x414D32: ??? (in /home/volker/test)
==26898== by 0x41409C: ??? (in /home/volker/test)
==26898== by 0x10765D17: ???
==26898== by 0xD1ABF87: ???
==26898== by 0xD22EAB7: ???
==26898==
==26898==
==26898== HEAP SUMMARY:
==26898== in use at exit: 2,141,586 bytes in 22,855 blocks
==26898== total heap usage: 131,074 allocs, 108,219 frees, 37,926,618 bytes allocated
==26898==
==26898== LEAK SUMMARY:
==26898== definitely lost: 8,600 bytes in 24 blocks
==26898== indirectly lost: 40,080 bytes in 835 blocks
==26898== possibly lost: 103,065 bytes in 1,728 blocks
==26898== still reachable: 1,889,177 bytes in 19,569 blocks
==26898== suppressed: 0 bytes in 0 blocks
==26898== Rerun with --leak-check=full to see details of leaked memory
==26898==
==26898== For counts of detected and suppressed errors, rerun with: -v
==26898== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)