Archived

This topic is now archived and is closed to further replies.

GDI resources going missing?

This topic is 5654 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

Im currently working on a small DirectDraw based 2D game engine. My problem is this, I load up the screen, drawing a small bitmap to the screen and the cursor and thats it, then when I leave the program I usually (maybe one in two tries) loose 1% of my GDI resources (I use the resource meter with windows to check this). The strange thing is I dont use GDI, well apart from setting up the window for directdraw, I laod all bitmaps in manually etc. Im wondering where these resources are most likely going? Im pretty sure all my buffers etc are being release dwhen the program ends, can GDI be lossed from an array not being released etc? Is there any clean up code for the standard windows that Im not aware of? I tried removing parts of my program, directInput, not loading any bitmaps etc. Until all there was, was a basic directdraw window loading up and being filled black each frame. I still would loose resources, any help would be greatly apreciated as this is driving me insane!!!! Ballistic Programs

Share this post


Link to post
Share on other sites
Interesting predicament. It might have something to do with your vcard drivers - I can''t speak to that. At any rate, check out the GDIObj tool available here: http://www.fengyuan.com/download.html. NT,2K,XP only but it sounds like your running one of those anyway. This tool provides mode information regarding GDI than the resource manager. It might help nail down the drain.

Share this post


Link to post
Share on other sites
Right Ive cut my program to the window and directDraw starting up then shutting down and it still looses resources, I go in the following order

Make Window
Setup LPDIRECTDRAW7
Set the dirextdraw window size
Set up primary surface
Attach backbuffer
Attach clipper

Release clipper
Release primary surface
Release LPDIRECTDRAW7

is there anything else I should be doing to tidy up?

Ballistic Programs

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Unregister Window? That''s all I can think of.

Share this post


Link to post
Share on other sites
Are you sure the code that closes everything is actually being run? An app I''m writing has an interesting problem right now; you can close it by hitting ESC, but it continues to run in the background. I believe this is because I''m missing the WM_DESTORY message or something, but I''m too lazy to fix it, ATM Perhaps you''re having a similar problem? I dunno.

Share this post


Link to post
Share on other sites
Yup, everything does get destroyed, all directx interfaces then the window then unregisterdd, in the end I dont think Im going to find the problem, I cant think of anything else to unload, then again Halflife looses 5% of my GDI resources once shutdown so maybe its the driver set up on my machine?

Ballistic Programs

Share this post


Link to post
Share on other sites