Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

What is a process handle and what can we know about a running process through the "handle count" property in a task explorer?

enter image description here

share|improve this question

2 Answers 2

up vote 12 down vote accepted

A process handle is an integer value that identifies a process to Windows. The Win32 API calls them a HANDLE; handles to windows are called HWND and handles to modules HMODULE.

Threads inside processes have a thread handle, and files and other resources (such as registry keys) have handles also.

The handle count you see in Task Manager is "the number of object handles in the process's object table". In effect, this is the sum of all handles that this process has open.

If you do not release your handle to a resource, other people may not be able to access it - this is why you sometimes cannot delete a file because Windows claims it is in use (check out this article on handle leaks and Process Explorer).

Also, there is a per-process limit on various handles. Here is an example.

In general, if you are opening handles and not closing them, it is analogous to leaking memory. You should figure out what is going on and fix it. There is a good CodeProject article on handle leaks.

share|improve this answer

A handle is an abstract reference to a resource. Handles are used when application software references blocks of memory or objects managed by another system, such as a database or an operating system.

Resource handles can be opaque identifiers, in which case they are often integer numbers, or they can be pointers that allow access to further information.

Common resource handles are file descriptors, sockets, database connections, process identifiers (PIDs), and job IDs.

reference
enter image description here
Analogy: The Handle is like a handle to the object

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.