diff options
author | Herbert Duerr [hdu] <duerr@sun.com> | 2010-08-16 13:39:40 +0200 |
---|---|---|
committer | Herbert Duerr [hdu] <duerr@sun.com> | 2010-08-16 13:39:40 +0200 |
commit | c44ba02b8439f592a8379f770c7058b70419398f (patch) | |
tree | 60de5488559a7fdf99967e56ad5adc9638354f4b | |
parent | 1fc79e17babe1511326f289e3539772674be9562 (diff) |
#i113604# allow forced garbage-collection on exit
-rw-r--r-- | vcl/source/glyphs/glyphcache.cxx | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/vcl/source/glyphs/glyphcache.cxx b/vcl/source/glyphs/glyphcache.cxx index 1953ecf553c4..7181db56dd4d 100644 --- a/vcl/source/glyphs/glyphcache.cxx +++ b/vcl/source/glyphs/glyphcache.cxx @@ -78,12 +78,18 @@ GlyphCache::~GlyphCache() void GlyphCache::InvalidateAllGlyphs() { -#if 0 // TODO: implement uncaching 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; -#endif + // 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; + } } // ----------------------------------------------------------------------- |