Cleaning up device objects..

Started by
3 comments, last by Toni Petrina 17 years, 6 months ago
I'm coming to the end of the grind with my current project but I encountered a little problem.. My app doesn't seem to clean up all my device objects in certain circumstances but in others it sorts everything out perfectly.. In my app I create the device-related objects for my menu system at startup and then create those which relate to my game when a new game has been selected and has begun to load.. once a game has finished I clean up all the game-related objects as I return to the main menu system and then clean up the main menu system objects on application termination.. Now when I load the app into the menus and then terminate the app its fine.. When I load up the app, load up a new game and then terminate the app its still not a problem.. However when I load up the app, a new game and then return from the game back to the main menu, on terminating the app I get a memory leak.. Please note that every app termination control calls exactly the same set of methods to clean up all the objects in the app.. I've tried running the debugger but it doesn't help me isolate exactly where the memory leak occured so I don't know which object is not being destroyed so I can sort out the code for it.. So I need to know how I could isolate the problem and then deal with it? Anyone else encountered any problems like this in the past? How did you overcome them?
Advertisement
You overcome it with smart pointers.
Every time you implement a singleton, God kills a kitten. Please, think of the kittens!
Have you tried to use PIX? PIX has a profile option called "replayable call stream". If you run your program in PIX with this option, it will give you a report of every object you created with DirectX. Once you have that, you can find which objects aren't being cleaned up and go from there.
Thanx for the headsup!

Do u know where I can find PIX?
It comes with DirectX SDK. Try Utilities folder in SDK installation dir.
So... Muira Yoshimoto sliced off his head, walked 8 miles, and defeated a Mongolian horde... by beating them with his head?

Documentation? "We are writing games, we don't have to document anything".

This topic is closed to new replies.

Advertisement