Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

UnregisterClass function may leak memory


View products that this article applies to.

Symptoms

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. 

↑ Back to the top


Cause

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

↑ Back to the top


Resolution

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.

↑ Back to the top


Keywords: kb

↑ Back to the top

Article Info
Article ID : 2624911
Revision : 1
Created on : 1/7/2017
Published on : 9/29/2011
Exists online : False
Views : 181