End Process

What happens to resources in video memory when you end the process of a Direct3D or OpenGL application through something like the Task Manager? Do they still eat up space in the VRAM or do they simply become unreferenced?
Last edited on
MSDN says:
If a process is terminated by TerminateProcess, all threads of the process are terminated immediately with no chance to run additional code. This means that the thread does not execute code in termination handler blocks. In addition, no attached DLLs are notified that the process is detaching.

Found here -> http://msdn.microsoft.com/en-us/library/ms686722%28v=VS.85%29.aspx

Also take a look at this -> http://radsoft.net/software/reviews/blacklist.shtml

EDIT: Though... On second thought, this might not be an answer to your question... I don't know what exactly the Task Manager does when you order it to terminate a process...

EDIT 2: Ok, clicking End Process on Task Manager does call TerminateProcess:
http://en.wikipedia.org/wiki/Windows_Task_Manager#Processes
Last edited on
I'd assume that from what MSDN said in that quote that it's still eating up space in video ram until you call a new program to reassign the memory.
it's still eating up space in video ram until you call a new program to reassign the memory
What's the difference between that and not using any memory at all?

I'm fairly sure the system frees those kinds of resources by calling the relevant drivers. If you want to check, try running a very graphics-heavy application and kill it. Do it until the system hangs from being unable to allocate more VRAM for other processes (VRAM can't be paged out), or you're convinced that those resources are being freed.
Last edited on
I've had to do an End Process on Crysis several times, didn't have any issues. I noticed that using Alt+F4 in Crysis seemed to terminate it almost immediately regardless of it using over 1GB of VRAM. I wasn't sure if it was just that fast at releasing video memory or if it used something like exit(), which, from my understanding is similar to TerminateProcess().
Eh, your way makes more sense helios..lol it's been a very long day.
A process has at least three ways to terminate: clean, dirty, and kill. A clean termination is when the process manually returns all its allocated resources to the system. During a dirty termination, the process immediately drop everything it's doing and terminates as soon as possible, leaving resource cleanup to the system. This is faster because, what to the process looks like 200 objects, to the system may look like a few memory pages. The downside is that all (if any) state that needed to be committed before exiting is lost. A kill is forced termination by the system. The kernel simply stops allocating CPU time for the process and unloads it. This is even faster than dirty termination because no more code is allowed to run. exit() still calls destructors for static objects, IINM.
NGen wrote:
I noticed that using Alt+F4...

I think Alt+F4 just sends a WM_CLOSE message to the currently active window. Try writing something in notepad and then hit Alt+F4. It will ask you if you want to save before quitting.
Topic archived. No new replies allowed.