Page 1 of 1

closeDevice() & drop()

Posted: Sun Mar 27, 2005 7:39 pm
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...

Posted: Sun Mar 27, 2005 7:47 pm
by jox
closeDevice() does not drop() anything. In Win32 it destroys the hWnd. You definitely have to drop() it yourself.

Posted: Sun Mar 27, 2005 8:04 pm
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...

Posted: Mon Mar 28, 2005 2:40 pm
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

Posted: Mon Mar 28, 2005 3:47 pm
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?

Posted: Mon Mar 28, 2005 4:27 pm
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...

Posted: Mon Mar 28, 2005 11:28 pm
by ntitan
K, thanks for the feedback.