Valgrind

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Arclamp
Posts: 71
Joined: Thu Oct 10, 2013 7:45 pm

Valgrind

Post by Arclamp »

Q: Are these leaks shown due to my system libraries?

If I make and build the following code with -g in the build flags, e.g.
g++ -I../../include -O3 -ffast-math -Wall -g main.cpp -o play -L../../lib/Linux -lIrrlicht -lGL -lXxf86vm -lX11

Code: Select all

 
#include <irrlicht.h>
 
using namespace irr;
 
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
 
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#endif
 
int main()
{
    IrrlichtDevice* device;
 
    device = createDevice(video::EDT_OPENGL, dimension2d<u32>(800, 400), 16, false, false, false);
    if (device == 0)
        return 1; // could not create selected driver.
    
    device->drop();
}
 
and here's the valgrind run:

Code: Select all

 
$ valgrind --leak-check=full --track-origins=yes ./play
 
==28811== Memcheck, a memory error detector
==28811== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==28811== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==28811== Command: ./play
==28811== 
==28811== Syscall param ioctl(generic) points to uninitialised byte(s)
==28811==    at 0x5F3C407: ioctl (syscall-template.S:81)
==28811==    by 0x8710B17: drmIoctl (xf86drm.c:175)
==28811==    by 0x8713A7B: drmPrimeHandleToFD (xf86drm.c:2701)
==28811==    by 0xA9D166D: drm_intel_bo_gem_export_to_prime (intel_bufmgr_gem.c:2729)
==28811==    by 0xA55BDF7: intel_query_image (intel_screen.c:563)
==28811==    by 0x4E8364D: dri3_alloc_render_buffer (dri3_glx.c:926)
==28811==    by 0x4E8364D: dri3_get_buffer.isra.10 (dri3_glx.c:1307)
==28811==    by 0x4E84499: dri3_get_buffers (dri3_glx.c:1466)
==28811==    by 0xA579486: intel_update_image_buffers (brw_context.c:1475)
==28811==    by 0xA579486: intel_update_renderbuffers (brw_context.c:1167)
==28811==    by 0xA5797B4: intel_prepare_render (brw_context.c:1188)
==28811==    by 0xA579906: intelMakeCurrent (brw_context.c:1031)
==28811==    by 0xA51A495: driBindContext (dri_util.c:538)
==28811==    by 0x4E82AA9: dri3_bind_context (dri3_glx.c:145)
==28811==  Address 0xffefff4a8 is on thread 1's stack
==28811==  in frame #2, created by drmPrimeHandleToFD (xf86drm.c:2695)
==28811==  Uninitialised value was created by a stack allocation
==28811==    at 0xA9CAB20: ??? (in /usr/lib64/libdrm_intel.so.1.0.0)
==28811== 
==28811== 
==28811== HEAP SUMMARY:
==28811==     in use at exit: 64,561 bytes in 358 blocks
==28811==   total heap usage: 43,238 allocs, 42,880 frees, 35,988,805 bytes allocated
==28811== 
==28811== 36 bytes in 1 blocks are definitely lost in loss record 14 of 67
==28811==    at 0x4C29C4F: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==28811==    by 0x82F4394: read_packet (xcb_in.c:254)
==28811==    by 0x82F4394: _xcb_in_read (xcb_in.c:934)
==28811==    by 0x82F23F0: _xcb_conn_wait (xcb_conn.c:495)
==28811==    by 0x82F3A8E: wait_for_reply (xcb_in.c:491)
==28811==    by 0x82F3BA0: xcb_wait_for_reply (xcb_in.c:521)
==28811==    by 0x4E83B48: dri3_open (dri3_glx.c:1670)
==28811==    by 0x4E83B48: dri3_create_screen (dri3_glx.c:1909)
==28811==    by 0x4E54AA0: AllocAndFetchScreenConfigs (glxext.c:793)
==28811==    by 0x4E54AA0: __glXInitialize (glxext.c:907)
==28811==    by 0x4E50A10: glXQueryVersion (glxcmds.c:487)
==28811==    by 0x407C5C: irr::CIrrDeviceLinux::createWindow() (CIrrDeviceLinux.cpp:401)
==28811==    by 0x406CA1: irr::CIrrDeviceLinux::CIrrDeviceLinux(irr::SIrrlichtCreationParameters const&) (CIrrDeviceLinux.cpp:116)
==28811==    by 0x405ACD: createDeviceEx (Irrlicht.cpp:89)
==28811==    by 0x405A7D: createDevice (Irrlicht.cpp:64)
==28811== 
==28811== 192 (16 direct, 176 indirect) bytes in 1 blocks are definitely lost in loss record 45 of 67
==28811==    at 0x4C2BB9C: realloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==28811==    by 0x532AB10: add_codeset.isra.10 (lcGeneric.c:186)
==28811==    by 0x532B08A: load_generic (lcGeneric.c:744)
==28811==    by 0x532C91E: initialize (lcGeneric.c:1014)
==28811==    by 0x532D12B: _XlcCreateLC (lcPubWrap.c:90)
==28811==    by 0x534A5CF: _XlcDefaultLoader (lcDefConv.c:764)
==28811==    by 0x53349DD: _XOpenLC (lcWrap.c:294)
==28811==    by 0x5334BFA: _XrmInitParseInfo (lcWrap.c:369)
==28811==    by 0x531C5EF: NewDatabase (Xrm.c:503)
==28811==    by 0x531FBCD: XrmGetStringDatabase (Xrm.c:1559)
==28811==    by 0x52FC633: InitDefaults (GetDflt.c:148)
==28811==    by 0x52FC85D: XGetDefault (GetDflt.c:220)
==28811== 
==28811== 18,100 (432 direct, 17,668 indirect) bytes in 1 blocks are definitely lost in loss record 67 of 67
==28811==    at 0x4C2B9C6: calloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==28811==    by 0x4061C20: udev_enumerate_new (in /usr/lib64/libudev.so.1.6.1)
==28811==    by 0x4E84EC7: get_render_node_from_id_path_tag (loader.c:260)
==28811==    by 0x4E84EC7: loader_get_user_preferred_fd (loader.c:396)
==28811==    by 0x4E83B9C: dri3_create_screen (dri3_glx.c:1923)
==28811==    by 0x4E54AA0: AllocAndFetchScreenConfigs (glxext.c:793)
==28811==    by 0x4E54AA0: __glXInitialize (glxext.c:907)
==28811==    by 0x4E50A10: glXQueryVersion (glxcmds.c:487)
==28811==    by 0x407C5C: irr::CIrrDeviceLinux::createWindow() (CIrrDeviceLinux.cpp:401)
==28811==    by 0x406CA1: irr::CIrrDeviceLinux::CIrrDeviceLinux(irr::SIrrlichtCreationParameters const&) (CIrrDeviceLinux.cpp:116)
==28811==    by 0x405ACD: createDeviceEx (Irrlicht.cpp:89)
==28811==    by 0x405A7D: createDevice (Irrlicht.cpp:64)
==28811==    by 0x405807: main (main.cpp:35)
==28811== 
==28811== LEAK SUMMARY:
==28811==    definitely lost: 484 bytes in 3 blocks
==28811==    indirectly lost: 17,844 bytes in 14 blocks
==28811==      possibly lost: 0 bytes in 0 blocks
==28811==    still reachable: 46,233 bytes in 341 blocks
==28811==         suppressed: 0 bytes in 0 blocks
==28811== Reachable blocks (those to which a pointer was found) are not shown.
==28811== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==28811== 
==28811== For counts of detected and suppressed errors, rerun with: -v
==28811== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0)
 
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Valgrind

Post by hendu »

Yes.
Arclamp
Posts: 71
Joined: Thu Oct 10, 2013 7:45 pm

Re: Valgrind

Post by Arclamp »

hmmm
Arclamp
Posts: 71
Joined: Thu Oct 10, 2013 7:45 pm

Re: Valgrind

Post by Arclamp »

Yeah ubuntu'd up n one on there too when leak check
Post Reply