Windows maintains a cache of display contexts that it uses for common and window display contexts. This cache contains five display contexts, which means only five common display contexts can be active at any one time. To prevent more than five from being retrieved, a window that uses a common or window display context must release that context immediately after drawing.
If a window fails to release a common display context, all five display contexts may eventually be active and unavailable for any other window. In such a case, Windows ignores all subsequent requests for a common display context. In the retail version of Windows, the system will appear to be deadlocked, while the debugging version of Windows will undergo a fatal exit, alerting the developer of a problem.
The ReleaseDC function releases a display context and returns it to the cache. Class and private display contexts are individually allocated for each class or window; they do not belong to the cache so they do not need to be released after use.