UnregisterClass function may leak memory

Applies to: Windows Vista BusinessWindows Vista Business 64-bit EditionWindows Vista Business N


The UnregisterClass function may leak memory when called to unregister a window class that was registered within an activation context. 

Dynamic link libraries (DLLs) that register their own window classes are responsible for unregistering those window classes when the DLL is unloaded. The memory leak that may occur in the UnregisterClass function can increase each time a DLL that registers its window classes within an activation context is loaded and unloaded in a process. 


The UnregisterClass function obtains a reference to the activation context that was used when registering the window class and does not release it.


Avoid scenarios where window classes are repeatedly registered and unregistered within an activation context, such as repeatedly loading and unloading DLLs that register their own window classes.