Clean It and get error!

Started by
3 comments, last by jollyjeffers 18 years ago
It's mentioned in the DX SDK that the clean up code should be handled upon receiving the WM_DESTROY message. However this seems to cause a problem upon exit (application error: breakpoint reached) even if I put the cleanup code at the end of the WinMain function. Where shoudl I add the cleanup code?
Advertisement
What errors are you getting?

Dave
The DXUT framework is always a good place to start - it's pretty much the textbook perfect reference implementation of how you should handle Direct3D [smile]

I've always handled my termination stuff at the end of WinMain and not had any problems. I wait for the quit message, bail out of the main loop on the next iteration and clean-up.

If you can provide us with more details then we might be able to spot something wrong with your implementation. Possibly you're destroying stuff and then accidentally re-using it (e.g. null pointers and other fun). Tell us which line its breaking on (use the VStudio callstack to identify which part of your code it stems from) and post any other relevant information and code fragments...

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

It seems to be a meory leak, resources still allocated, problem. I get this error from debug: when exist

Direct3D9: (WARN) :Memory still allocated! Alloc count = 249

The resources (textures/VBs/IBs) are all managed, and I don't think I need to release and re-create them when resetting the device.

Thanks.



Quote:Original post by quaker
The resources (textures/VBs/IBs) are all managed, and I don't think I need to release and re-create them when resetting the device.
No, you don't - but you do need to make sure that they're all SAFE_RELEASE()'d when the application finally closes down.

Debugging Direct3D memory leaks is an art in itself, my current preferred method is to run a full call-stream capture in PIX. Advance to the very last entry and check which resources are still flagged as "alive" - these are more than likely to be the ones that are causing you problems [smile]

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

This topic is closed to new replies.

Advertisement