Memory leak in createDevice? (Not a bug)

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
alc
Posts: 31
Joined: Sun Jun 25, 2006 10:59 pm
Location: Denmark

Memory leak in createDevice? (Not a bug)

Post by alc »

I have a larger application that runs fine. However, when the application terminates, VC reports a memory leak. Trying to find the cause of this, if learned that this happens even when the main function is reduced to

Code: Select all

int main()
{	
  IVideoDriver *driver;
  IGUIEnvironment *env;
  ISceneManager *smgr;

  GLOBAL::device = createDevice(video::EDT_DIRECT3D9, core::dimension2d<s32>(800, 600),16,false,true);
return 0xFE;	
}
The FE return code is to help me make sure, that it is my own termination. I'm using svn 194 fresh this morning from the repository. Any thought on this? So far my app runs fine, so it is not critical for me. But a memory leak in createDevice is not a pleasant though altogether!
Last edited by alc on Mon Sep 11, 2006 8:41 am, edited 1 time in total.
Warchief
Posts: 204
Joined: Tue Nov 22, 2005 10:58 am

Post by Warchief »

Call

Code: Select all

device->drop();
before app end.

It's like calling a "new" without "delete" to free memory.
From irrlicht help:
When you create an object in the Irrlicht engine, calling a method which starts with 'create', an object is created, and you get a pointer to the new object. If you no longer need the object, you have to call drop(). This will destroy the object, if grab() was not called in another part of you program, because this part still needs the object. Note, that you only need to call drop() to the object, if you created it, and the method had a 'create' in it.
alc
Posts: 31
Joined: Sun Jun 25, 2006 10:59 pm
Location: Denmark

Post by alc »

DOH!! My bad entirely!!

The latest svn started givin' me mem leaks, and it came from a missing ->drop() somewhere in my code, a miss that apparently didn't cause problems earlier. In my hast to isolate the problem, I forgot the most obvious ->drop of them all ... thanx!
Post Reply