Leaks in Irrlicht?

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
RageD
Posts: 34
Joined: Mon Jun 13, 2005 2:34 pm

Leaks in Irrlicht?

Post by RageD »

Hello,

I was wondering if there are any known leaks in Irrlicht. I am writing a small library for use with Irrlicht, and I went to check it for leaks and (after running it through valgrind) received this response:

Code: Select all

ERROR SUMMARY: 3 errors from 3 contexts
The errors seem to all come from Irrlicht's createDevice() as an origin. I know my other code isn't leaking because I ran it through the debugger without Irrlicht.

In any case, I am more concerned that I am doing something improperly if Irrlicht has no leaks. In the constructor of one of my classes, I initialize a private member (of type irr::IrrlichtDevice*) doing this:

Code: Select all

device = createDevice(...);
Then, in the destructor, I have this:

Code: Select all

if(device)
        device->drop();
Am I missing something? This is all the Irrlicht code I am currently using (i.e. I have not begun using any other objects). I do, however, call device->getVideoDriver() for beginScene() and endScene() (if this would cause any leaks since I have not assigned it to any member, nor have I dropped it).

Thanks for your help. I am also using the OpenGL drivers.

-RageD
DuF = (del)F.u
Microsonic Development
CuteAlien
Admin
Posts: 9693
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

I suspect you are using valgrind? Doesn't that give you where the leaks are? Anyway - we use that ourselves regularly and at least here the first example does not leak (others also shouldn't, but haven't run them right now).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
serengeor
Posts: 1712
Joined: Tue Jan 13, 2009 7:34 pm
Location: Lithuania

Post by serengeor »

I have 3 leaks also, but I don't think it is irrlicht causing them. I used valgrind and it showed me that it leaks somewhere in the video drivers (nvidia).
Working on game: Marrbles (Currently stopped).
RageD
Posts: 34
Joined: Mon Jun 13, 2005 2:34 pm

Post by RageD »

Ah, thanks guys - serengeor is right; it's the video drivers. I didn't read far enough up, my apologies.

Code: Select all

==14969== HEAP SUMMARY:
==14969==     in use at exit: 27,758 bytes in 318 blocks
==14969==   total heap usage: 3,119 allocs, 2,801 frees, 667,560 bytes allocated
==14969== 
==14969== 112 (8 direct, 104 indirect) bytes in 1 blocks are definitely lost in loss record 59 of 74
==14969==    at 0x4005A02: realloc (vg_replace_malloc.c:476)
==14969==    by 0x876A73: ??? (in /usr/lib/libX11.so.6.2.0)
==14969==    by 0x877623: ??? (in /usr/lib/libX11.so.6.2.0)
==14969==    by 0x8793E7: _XlcCreateLC (in /usr/lib/libX11.so.6.2.0)
==14969==    by 0x89843A: _XlcDefaultLoader (in /usr/lib/libX11.so.6.2.0)
==14969==    by 0x880952: _XOpenLC (in /usr/lib/libX11.so.6.2.0)
==14969==    by 0x880A4D: _XrmInitParseInfo (in /usr/lib/libX11.so.6.2.0)
==14969==    by 0x868E20: ??? (in /usr/lib/libX11.so.6.2.0)
==14969==    by 0x86A937: XrmGetStringDatabase (in /usr/lib/libX11.so.6.2.0)
==14969==    by 0x843F0D: XGetDefault (in /usr/lib/libX11.so.6.2.0)
==14969==    by 0xB0D1AC: _XcursorGetDisplayInfo (in /usr/lib/libXcursor.so.1.0.2)
==14969==    by 0xB0D42C: XcursorSupportsARGB (in /usr/lib/libXcursor.so.1.0.2)
==14969== 
==14969== 1,384 (124 direct, 1,260 indirect) bytes in 1 blocks are definitely lost in loss record 68 of 74
==14969==    at 0x4004C42: calloc (vg_replace_malloc.c:418)
==14969==    by 0xCD79AE: __glXInitVertexArrayState (in /usr/lib/libGL.so.1.2)
==14969==    by 0xCC1049: glXMakeContextCurrent (in /usr/lib/libGL.so.1.2)
==14969==    by 0xCC10E2: glXMakeCurrent (in /usr/lib/libGL.so.1.2)
==14969==    by 0x41EB5A3: irr::CIrrDeviceLinux::createWindow() (CIrrDeviceLinux.cpp:713)
==14969==    by 0x41EC42D: irr::CIrrDeviceLinux::CIrrDeviceLinux(irr::SIrrlichtCreationParameters const&) (CIrrDeviceLinux.cpp:109)
==14969==    by 0x41E4F5A: createDeviceEx (Irrlicht.cpp:87)
==14969==    by 0x41E507C: createDevice (Irrlicht.cpp:62)
==14969==    by 0x41E45F2: MyLIB::Irrlicht_Renderer::Irrlicht_Renderer(irr::video::E_DRIVER_TYPE, irr::core::dimension2d<unsigned int> const&, unsigned int, bool, bool, bool) (Irrlicht_Renderer.cpp:49)
==14969==    by 0x41E0EAA: MyLIB::RenderManagerImpl::RenderManagerImpl() (RenderManagerImpl.cpp:41)
==14969==    by 0x41DDF86: MyLIB::GameManagerImpl::start() (GameManagerImpl.cpp:67)
==14969==    by 0x804B10A: testmemory() (main.cpp:15)
Seems to be a problem with OpenGL which, on most systems, would probably be out of my control.

Thanks!

-RageD
DuF = (del)F.u
Microsonic Development
Post Reply