Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Dark GDK Not Freeing Resources

Author
Message
Shawn Odekirk
15
Years of Service
User Offline
Joined: 25th Aug 2009
Location:
Posted: 25th Aug 2009 18:12
I just downloaded Visual Studio 2008 Express and the Dark GDK from the Microsoft website.
I created a new project and used the "Dark GDK - Game" wizard, and then compiled and ran the program. After I exited the program I noticed many DirectX errors in the Visual Studio output window. It looks like Dark GDK is not calling Release on all of the interfaces it has allocated before the program exits.
Are there any patches that fix these problems?

Thanks,
Shawn
Todd Riggins
20
Years of Service
User Offline
Joined: 29th Oct 2004
Location: Texas, USA
Posted: 25th Aug 2009 22:57 Edited at: 25th Aug 2009 22:58
Hi, can you copy and paste the errors you get here from the output window? What program did you compiled and run? It might help us help you to figure out whats going on. Thanks.

Shawn Odekirk
15
Years of Service
User Offline
Joined: 25th Aug 2009
Location:
Posted: 26th Aug 2009 16:32
Thank you for your reply.
Using the DirectX Control Panel I have set DirectX to use the debug version of the D3D9 runtime.
I created a new project using the "Dark GDK - Game" template. I did not modify the generated code at all.
With the DirectX debug level set to minimum I get a ton of the following errors:

Direct3D9: (ERROR) : [0] : Address 0CCFE4CB
Direct3D9: (ERROR) : [1] : Address 0CCFE59B
Direct3D9: (ERROR) : [2] : Address 0CCFE440
Direct3D9: (ERROR) : [3] : Address 0CCF2DB4
Direct3D9: (ERROR) : [4] : Address 4FDFAF2E
Direct3D9: (ERROR) : [5] : Address 004D5595
Direct3D9: (ERROR) : [6] : Address 00000000
Direct3D9: (ERROR) : [7] : Address 00000000
Direct3D9: (ERROR) : [8] : Address 00000000
Direct3D9: (ERROR) : [9] : Address 00000000
Direct3D9: (ERROR) : [10] : Address 00000000
Direct3D9: (ERROR) : [11] : Address 00000000
Direct3D9: (ERROR) : [12] : Address 00000000
Direct3D9: (ERROR) : [13] : Address 00000000
Direct3D9: (ERROR) : [14] : Address 00000000
Direct3D9: (ERROR) : [15] : Address 00000000

I have seen this error when I forget to call Release on one of the DirectX resources I've allocated.

The following error is also present:

Direct3D9: (ERROR) :BeginScene, already in scene. BeginScene failed.

If I turn the DirectX debugging level up I start to see the following errors:

Direct3D9: (WARN) :Ignoring redundant SetSamplerState. Sampler: 2, State: 7
Direct3D9: (WARN) :Ignoring redundant SetTextureStageState. Stage: 2, State: 11

I am most concerned with the first error because it seems to indicate that DarkGDK is not releasing all of the resources it has allocated.
Does anyone know if there is a fix for this problem?

Thanks,
Shawn
Todd Riggins
20
Years of Service
User Offline
Joined: 29th Oct 2004
Location: Texas, USA
Posted: 26th Aug 2009 18:24


It's almost like you are trying to run the same process that is running in the background( which would make sense to what you said about not releasing resources above). After when that happens to you, have you looked in the task manager(processes) to see mabie a process of the same program you compiled and ran before mabie stuck in the background?

That's indeed strange. BTW, What version of DirectX are you running?

ah, and ofcoarse, I never could get the "Dark GDK - Game" wizards to work for me. Mabie that has something to do with it.

Have you tried creating a new clean Win32 project and simply adding the code from one of those wizards? That's what I had to do when I first installed the GDK correctly and found out the wizards didn't work. With the info you provided, my gut feeling saying it's the wizards fault. But I'm probabaly wrong about that.

I'll try to think of something else... besides of re-installing everything.

Manga Tiger Boy
15
Years of Service
User Offline
Joined: 24th Aug 2009
Location:
Posted: 27th Aug 2009 03:03
When I first installed, I had similar problems, but I easily fixed them by upgrading my version of DirectX. But that's just me...

Join the dark side. We have cookies!
Shawn Odekirk
15
Years of Service
User Offline
Joined: 25th Aug 2009
Location:
Posted: 27th Aug 2009 16:23
Todd,
Thanks again for your replies.
I am running DirectX 9.0c.
The game wizards seem to work fine for me. I have run through each of the tutorials that come with Dark GDK and they all exhibit this problem.

Manga Tiger Boy,
Thanks for your reply.
After upgrading your DirectX did you use the DirectX control panel to set DirectX to use the debug version of the D3D runtime? These errors only show up if you are using the debug version of the D3D runtime, not the retail version.

It is generally a good idea to do some testing on your game using the Direct3D debug runtime. The debug runtime contains some additional checks to ensure that you are freeing all of the DirectX resources you have allocated and that you are calling the DirectX functions correctly. If you forget to call Release on one of the interfaces you have allocated the DirectX debug runtime will let you know.
The debug runtime does run more slowly than the retail version, so I wouldn't recommend using the debug runtime all the time, but you should use it once in a while to help ensure your game is as bug free as possible.
I'm not going to worry too much more about it. The Dark GDK looks like a good way to get a simple game up and running quickly. It seems to have a bunch of good helper functions and provides a nice basic game framework. I'll just stick with the DirectX retail runtime and pretend there are no errors.

Thanks,
Shawn
Shawn Odekirk
15
Years of Service
User Offline
Joined: 25th Aug 2009
Location:
Posted: 27th Aug 2009 16:51
Here is a very basic example, not using Dark GDK, that demonstrates the problem of not freeing DirectX resources.



Before exiting, a program should free all of the resources it has allocated. In this example, the line to release the Direct3D interface is commented out.
If you compile and run this using the Direct3D debug runtime you should see several errors indicating that memory was still allocated when the program terminated.
Sorry, I know I said I wasn't going to worry about this anymore, but I just wanted to post a very simple example that demonstrated the problem.

Shawn
Todd Riggins
20
Years of Service
User Offline
Joined: 29th Oct 2004
Location: Texas, USA
Posted: 3rd Sep 2009 00:18
Arg, forgive me for the late reply... I didnt see this thread as having new posts.

Ok I admit that sometimes I'm a bit dingy and it finally clicked to me on what you where doing. I checked out the debug mode in the control panel and finally see what you see. Good catch!

You might want to email Lee directly about this for a quicker answer. That definetly needs to get fix'd!

Michael P
18
Years of Service
User Offline
Joined: 6th Mar 2006
Location: London (UK)
Posted: 3rd Sep 2009 00:46
Is LoopGDK being used? When this returns 0 resources will probably be released; i'm just guessing but you might want to try it.

Todd Riggins
20
Years of Service
User Offline
Joined: 29th Oct 2004
Location: Texas, USA
Posted: 3rd Sep 2009 01:55 Edited at: 3rd Sep 2009 01:55
When the "use Debug version of DirectX 9" is checked in the DirectX Control Panel, somehow DirectX can see if DirectX interfaces are not released after when a program shuts down. Thus, the visual IDE will catch and display these GDK errors.

Yes the program exits with 0.

Here's an example of one of my programs that will compile and run fine, but while using the debug version of DirectX, set in the DirectX Control Panel, DirectX will catch unreleased resources:

[Edited bunch of times, shortened, keep getting "Unknown System Error while posting reply"]

Direct3D9: (INFO) :======================= Hal HWVP device selected

Direct3D9: (INFO) :Using FF to VS converter

Direct3D9: (INFO) :Using FF to PS converter

Direct3D9: (ERROR) :BeginScene, already in scene. BeginScene failed.

[heaps of lines like this that say the same thing]
Direct3D9: (WARN) :Can not render to a render target that is also used as a texture. A render target was detected as bound, but couldn't detect if texture was actually used in rendering.

The thread 'Win32 Thread' (0x12dc) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x12c0) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0xd0c) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x10c4) has exited with code 0 (0x0).
Direct3D9: (ERROR) :Memory still allocated! Alloc count = 251
Direct3D9: (ERROR) :Current Process (pid) = 000003f0

[heaps of stuff like this]
Direct3D9: (ERROR) :Memory Address: 00f207f4 lAllocID=1 dwSize=00004bc4, ReturnAddr=65d399aa (pid=000003f0)
Direct3D9: (ERROR) :Memory Address: 00f253ec lAllocID=2 dwSize=0000031c, ReturnAddr=65d3c90a (pid=000003f0)
Direct3D9: (ERROR) :Memory Address: 00f2573c lAllocID=3 dwSize=00000c28, ReturnAddr=65d429d1 (pid=000003f0)
Direct3D9: (ERROR) :Memory Address: 00c4cc5c lAllocID=5 dwSize=0001cbc4, ReturnAddr=65d4a268 (pid=000003f0)

Direct3D9: (ERROR) :Total Memory Unfreed From Current Process = 5461844 bytes
The program '[1008] shadowmapexample.exe: Native' has exited with code 0 (0x0).

Login to post a reply

Server time is: 2024-11-20 15:23:43
Your offset time is: 2024-11-20 15:23:43