Skip to main content
gamedev.net
🔒 Locked

-Release() Question

Started by ProgrammerDX 1 reply 650+ views
Original Post
ProgrammerDX
ProgrammerDX
Hi

If your program closes without Releasing (->Release) objects like the device, textures, vertex buffers, will you get a permanent leak even if your process is closed? Or will Windows manage all remaining directx buffers to be released (also from the video card memory)?

Thanks
programci_84
programci_84
The only thing I can say is windows does not release that sources unless you call Release() for'em.

You can test it:
Declare an LPDIRECT3DTEXTURE9 object as a global variable. In WinMain(), load a texture in it from a file via D3DXCreateTextureFromFile(). Then save that texture via D3DXSaveTextureToFile(). Finally, close your program, but don't call Release() before closing (don't use it anywhere as well). Make a copy of the file that D3DXSaveTextureFromFile() created.

Snippet:
//we'll create a texture and save itLPDIRECT3DTEXTURE9 pTex = NULL;INT WINAPI WinMain(/*...*/){//device creation etc.D3DXCreateTextureFromFile (pDevice, "blahblah.bmp", &pTex);D3DXSaveTextureToFile ("test_blahblah.bmp", D3DXIFF_BMP, pTex, NULL);}


Go to your buildier (e.g. VC2008). Make a modification like below, compile and run it step-by-step.

Snippet:
LPDIRECT3DTEXTURE9 pTex = NULL;INT WINAPI WinMain(/*...*/){//device creation etc.//D3DXCreateTextureFromFile (pDevice, "blahblah.bmp", &pTex);D3DXSaveTextureToFile ("test_blahblah.bmp", D3DXIFF_BMP, pTex, NULL);}


While step-by-step debugging, once you passed the file-saver line that you added, open that crated-file and compare it with other copy. You see that they're all very similar.

hth.
-R
There's no "hard", and "the impossible" takes just a little time.
rip-off
rip-off
The operating system kernel can clean up most resources. You might have issues with buggy video drivers causing strange behaviour when a program crashes or quits without shutting down - in particular I've seen cases where the desktop resolution and bit depth sometimes doesn't get restored properly.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.