diff --git a/include/core/SkGraphics.h b/include/core/SkGraphics.h index 90c92e3219..c89758b70b 100644 --- a/include/core/SkGraphics.h +++ b/include/core/SkGraphics.h @@ -21,6 +21,9 @@ public: */ static void Init(); + /** + * Call this to release any memory held privately, such as the font cache. + */ static void Term(); /** diff --git a/src/core/SkGraphics.cpp b/src/core/SkGraphics.cpp index 8cfb4322a7..1b56936c8e 100644 --- a/src/core/SkGraphics.cpp +++ b/src/core/SkGraphics.cpp @@ -126,8 +126,7 @@ void SkGraphics::Init() { #include "SkTypefaceCache.h" void SkGraphics::Term() { - SkGlyphCache::SetCacheUsed(0); - SkTypefaceCache::PurgeAll(); + PurgeFontCache(); } #ifndef SK_DEFAULT_FONT_CACHE_LIMIT @@ -159,6 +158,7 @@ size_t SkGraphics::SetFontCacheLimit(size_t bytes) { void SkGraphics::PurgeFontCache() { SkGlyphCache::SetCacheUsed(0); + SkTypefaceCache::PurgeAll(); } ///////////////////////////////////////////////////////////////////////////////