[1] If this occurs frequently or repeatedly over an extended period of time, a large number of handles may be marked in-use and thus unavailable, causing performance problems or a crash.
One cause of a handle leak is when a programmer mistakenly believes that retrieving a handle to an entity is simply obtaining an unmanaged reference, without understanding that a count, a copy, or other operation is actually being performed.
Another occurs because of poor exception handling design patterns when programmers do not consider that when an exception occurs and a sub routine is exited prematurely, the cleanup code at the end of the routine may not be executed.
If the handle was just a pointer to some data structure with no additional management, then allowing the handle to pass out of scope would not cause an issue.
However, in many cases, such handles must be explicitly closed or released to avoid leaking resources associated with them; the exact requirements for what must be done with a handle varies by interface.