The information in this article applies to:
SYMPTOMS
When a window's map mode is set to either MM_ISOTROPIC or MM_ANISOTROPIC,
and the window extents or viewport extents are changed, then a previously
selected font instance cannot be found in the GDI font instance heap
because the extents are part of the lookup comparison criteria. This
results in 52 bytes of lost heap space for each new font instance.
CAUSE
When a font is selected into a device context, the current window and
viewport extents are copied to a structure that is stored in an internal
"font instance" heap. A search is conducted in this heap for the current
font, so that it can be freed. The lookup criteria to find this includes
the window and viewport extents. If either of these extents have changed
since the current font was selected, then the lookup fails and the item is
not removed from the heap, which results in a loss of 52 bytes of memory.
RESOLUTIONThe following algorithm is recommended for WM_PAINT handling, and it assumes that:
The C code fragment below is an example that describes the algorithm mentioned above, and assumes that the map mode and the values in the global SIZE structure "sWinExt" are being modified elsewhere in the program: Sample Code WARNING: ANY USE BY YOU OF THE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this code "as is" without warranty of any kind, either express or implied, including but not limited to the implied
warranties of merchantability and/or fitness for a particular purpose.
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. MORE INFORMATIONFonts are normally selected in the code that handles a WM_PAINT message for a given window. Window and viewport extents are typically modified according to the user's choice for a window "zoom factor" by resizing the window itself or by predetermined factors involving screen resolution and presentation data, such as that used for CAD. Additional query words: GDI font heap leak 52 UniSys
Keywords : kbSDKWin32 kbWinOS95 kbDSupport |
Last Reviewed: June 25, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |