PRB: Creating Many Fonts Causes a GPF in Windows 3.1Last reviewed: July 23, 1997Article ID: Q119454 |
3.10
WINDOWS
kbprg kbprb
The information in this article applies to:
SYMPTOMSWhen you create or generate TrueType fonts, selectors are lost. Eventually, if you create enough fonts, this problem causes a general protection fault (GPF) in your application.
CAUSEUnder Windows version 3.1, each time a new TrueType font is created, the cache is allocated to hold the TrueType font data. This memory is allocated as discardable memory, so that Windows can discard the font data and give the memory to other applications that need more memory. This way, TrueType font caching does not adversely affect available memory. The cache memory blocks are not discarded unless forced. Deleting the font handle (HFONT) does not cause the TrueType font cache memory to be deleted. This is a system optimization made in case another application uses the same font. Each cached TrueType font uses two selectors for its font data. Windows has a system-wide limit of 8192 selectors. When you create many TrueType fonts at once, you can run out of free selectors, which causes Windows to behave unexpectedly; your application may have a general protection fault (GPF). Deleting the font handles when you are finished with the fonts does not prevent this behavior. In addition, if you allocate a single TrueType font and change the mapping mode frequently, a new physical font is generated for each mapping-mode change. This can also cause the system to run out of free selectors and your application to have a GPF.
RESOLUTIONGlobalAlloc() a large block of memory, create a font, and then delete the font. This forces segments to be discarded, so that the selectors are freed. The True Type font cache in Windows 95 is designed so that this problem does not occur.
|
Additional reference words: 3.10
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |