Advertisement

Program shuts down very slowly - need help.

Started by August 21, 2000 10:59 PM
2 comments, last by Isaac Vanier 24 years, 4 months ago
I''ve got a graphical demo up and running. When I run it for about 10 minutes, then exit, the window closes down, but it takes a LONG time to actually shut down and give processing time back to the system. The HDD light will sit there and flicker like mad for quite a while - longer than it takes to load the game data in the first place. If I just start the demo up run it for 1 minute, and shut down, it closes down fine with no delays. Does anyone have any ideas as to why this is happening? I know there are a couple pieces of data that I''m not unloading. The demo uses DX7. It''s compiled in Debug mode with MSVC 6.0 Pro. My system is a 450mhz with 64MB. Voodoo 3500 TV AGP. When the program shuts down, I''m not writing anything to disk, so the only reason I can see why the HDD light is coming on would be because of Window''s virtual memory system/swapping. Any ideas/fixes are greatly appreciated. Thanks for the time Isaac
sounds like youve got a memory leak somewhere
Advertisement
I''ll expand on that:

when a program shuts down the memory the program takes up is ''cleared out'',
so somehow you are using huge amounts of memory, probably unknowingly so it''s called a memory leak.

You read through your code see if there''s anywhere that could do this.

DX++ The DirectX Programming Site
Thanks for the info guys. I figured it might be a memory leak, but I didn''t think I had any, so I was wondering if it could be something else. It wasn''t

All in all, it took 5 16 hour days to get it fixed. First of all I had to convert my entire engine from using malloc/free to new/delete. Then I overloaded new and delete to keep track of all allocations/deallocations, and display any leaks when the program shuts down. I got that idea from an article on Flipcode. Turns out I had 200kb of memory from about 700 different sources that wasn''t getting deleted, and I had no idea Spent a day or 2 fixing all of those. Once I got to 0 I felt pretty good, but it didn''t fix the problem at all.

So then I started stress testing each of the game''s main event''s/objects. Found the one that caused the problem, and fixed it. Turned out it wasn''t memory I was allocating. I was creating a vertext buffer with 1 vertex quit often (few times per second for 10 minutes adds up , and then not releasing them so they were getting lost. During program shutdown, DX automatically tries to delete these vertex buffers but they''re long gone so the program takes all day to shut down, and usually stops responding.

Well I fixed the problem, and got rid of the run-time VB creation, and now the program runs a ton faster

Thanks for the input!

This topic is closed to new replies.

Advertisement