Sign in to follow this  

is D3DDevice Releasing Automatically ?

This topic is 4035 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello everyone, i always see following code in examples if (g_pd3dDevice <> nil) then {$IFDEF TMT} g_pd3dDevice.Release; {$ELSE} g_pd3dDevice:= nil; {$ENDIF} is D3DDevice Releasing Automatically

Share this post


Link to post
Share on other sites
What language is that? Pascal?

No, the device does not release itself automatically, you must call it's Release() method to free the resources associated with it. The reason a lot of code tends to check that the device isn't null/nill at shutdown is that it's possible the shutdown code will be called more than once (E.g. if an error occurs, and then again at application exit). That would cause the device to be released, but then it would be referenced again by the Release() call, which would cause an access violation and a lovely Windows "The application has encountered an error" message box...

Share this post


Link to post
Share on other sites
thanks Evil Steve

what ever is that "TMT" flag, it doesnt work in my pascal code so the second code works "g_pd3dDevice:= nil;"

my COM object (g_pd3dDevice) has a "_Release" command not a "Release".
that two command are different?
may be g_pd3dDevice does release itself when the hwnd(window) destroying

any way i'm a finicky person so its make me restless

Share this post


Link to post
Share on other sites
That looks like some sort of preprocessor stuff in Pascal. If your device has a _Release() method, you should probably call that. I'm not realyl sure about Pascal though.

You should get some sort of debug output from D3D, and any memory leaks from un-Release()d interfaces will be shown there.

Share this post


Link to post
Share on other sites

This topic is 4035 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this