closeDevice() & drop()

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
cartoonit
Posts: 286
Joined: Mon Nov 15, 2004 6:36 pm

closeDevice() & drop()

Post by cartoonit »

Just in case my problem is something to do with Irrlicht, I doubt it very much, but this has been wandering around my head for sometime as well.

When you make a call to closeDevice() say for an escape press, does this on exit from within the class drop the entire device as well, or do you have to call drop in the destructor as well?? I've done both in test applications, and it seems to work fine calling both closeDevice(), and then dropping the device... In my main app it seems to sulk, well start causing me all sorts of problems, cheez I've just had a thought...
jox
Bug Slayer
Posts: 726
Joined: Thu Apr 22, 2004 6:55 pm
Location: Germany

Post by jox »

closeDevice() does not drop() anything. In Win32 it destroys the hWnd. You definitely have to drop() it yourself.
It is like it is. And because it is like it is, things are like they are.
cartoonit
Posts: 286
Joined: Mon Nov 15, 2004 6:36 pm

Post by cartoonit »

Cool cheers, Jox, that might be one of my problems, just discovered what my other problems are, something to do with Newton, yet I'm convinced I'm cleaning up after it properly...
ntitan
Posts: 21
Joined: Tue Mar 22, 2005 2:44 pm

Post by ntitan »

Sorry, I'm new to C++. What happens if you "don't" clean up your data on exit? Right now my app is not calling any destructors for my newton data. Will the OS clean this up for you eventually, or does the memory just sit out there unusable?

Thanks,
Nihal
sarin-didnt-log-in

Post by sarin-didnt-log-in »

usually, an app without that kind of destructors will leak memory, and the computer will slow if too much memory is not freed. but on your question i dont no myself, and ive got my own problem here.
for the example 01, hello world, what wouold be the way to clean up everything (vars, pointers, and the irrlicht classes)? does device->drop() close all things in irrlicht, such as loaded meshes and textures?
cartoonit
Posts: 286
Joined: Mon Nov 15, 2004 6:36 pm

Post by cartoonit »

The Newton cleans, up if you look at my agghh memory leaks post in the off topic section, theres a link to the Newton board. I think Newton cleans up itself completely after the last } of the application...

Yes drop cleans up everything from Irrlicht as far as I know, because it drops the reference counter to zero and everything is kept as a reference by the device...

For any pointers by new you have to clean up...
ntitan
Posts: 21
Joined: Tue Mar 22, 2005 2:44 pm

Post by ntitan »

K, thanks for the feedback.
Post Reply