View unanswered posts | View active topics It is currently Mon Aug 29, 2016 8:47 am

Reply to topic  [ 3 posts ] 
 DX Memory Debug Stuff 
Author Message

Joined: Fri Sep 24, 1999 7:01 am
Posts: 18
Location: Cleveland, OH
Post DX Memory Debug Stuff
When you have the DX debug runtime installed and run your dx app through the debugger, in the dubug window it'll show a "Memory still allocated" message, and for me, lists a ton of memory addresses and such.

Does anyone know how I can match those up to see what exactly in my code isn't getting released? I tried comparing them against values of my lpdds vars for all of my surfaces (Using DirectDraw), but none of them seemed to match up.

Wed Apr 16, 2003 1:25 am
Profile WWW

Joined: Mon Sep 02, 2002 7:01 am
Posts: 10
Location: Stockport, Manchester, UK
Post DX Memory Debug Stuff
Hard to do. I managed to find memory leaks in my game like so:

- Shut down all apps not related to your game.
- Run your game several times in the debugger. If the suns shining on you, then the memory leaks will always be in the same place.
- Watch on that area of memory.
- Step through your game until that area of memory is written to. Last line of code is where you'll find your leak.

Thu Apr 17, 2003 10:29 am

Joined: Thu Nov 30, 2000 8:01 am
Posts: 25
Location: Williamsport, PA
Post DX Memory Debug Stuff
This is the best way to find memory leaks and it should work for DirectDraw.

Run (and close) your application and copy down the block numbers of the memory leaks reported. They should be the first number listed for each leak and should be enclosed in either parenthesis or curly braces.

Place a break point at the earliest point of execution in your program. The first statement in WinMain would be a great place.

Add a watch for _crtBreakAlloc. It's value will be -1 if you have access to the variable. Just change the value to one of the blocks you copied down earlier. Let the program run and it will break when the memory is allocated for the suspected memory leak.

From there, all you need to do is trace back through the call stack to the actual allocation. It should either be a new, malloc, or a DirectX function.

Hope this helps.

Direct3D is much nicer with its debugging options. As you can set the D3D properties to automatically break on memory leaks and function calls that fail.

Thu Apr 17, 2003 7:09 pm
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware.