summaryrefslogtreecommitdiff
path: root/vcl/source/glyphs/glyphcache.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source/glyphs/glyphcache.cxx')
-rw-r--r--vcl/source/glyphs/glyphcache.cxx16
1 files changed, 14 insertions, 2 deletions
diff --git a/vcl/source/glyphs/glyphcache.cxx b/vcl/source/glyphs/glyphcache.cxx
index 6824b7d70ac8..deef658c0c56 100644
--- a/vcl/source/glyphs/glyphcache.cxx
+++ b/vcl/source/glyphs/glyphcache.cxx
@@ -85,6 +85,18 @@ GlyphCache::~GlyphCache()
void GlyphCache::InvalidateAllGlyphs()
{
+ // an application about to exit can omit garbage collecting the heap
+ // since it makes things slower and introduces risks if the heap was not perfect
+ // for debugging, for memory grinding or leak checking the env allows to force GC
+ const char* pEnv = getenv( "SAL_FORCE_GC_ON_EXIT" );
+ if( pEnv && (*pEnv != '0') )
+ {
+ // uncache of all glyph shapes and metrics
+ for( FontList::iterator it = maFontList.begin(); it != maFontList.end(); ++it )
+ delete const_cast<ServerFont*>( it->second );
+ maFontList.clear();
+ mpCurrentGCFont = NULL;
+ }
}
// -----------------------------------------------------------------------
@@ -289,9 +301,9 @@ void GlyphCache::UncacheFont( ServerFont& rServerFont )
// -----------------------------------------------------------------------
-ULONG GlyphCache::CalcByteCount() const
+sal_uLong GlyphCache::CalcByteCount() const
{
- ULONG nCacheSize = sizeof(*this);
+ sal_uLong nCacheSize = sizeof(*this);
for( FontList::const_iterator it = maFontList.begin(); it != maFontList.end(); ++it )
{
const ServerFont* pSF = it->second;