From 4db8132fe1d760bbd0356ddad0ecd8496b893933 Mon Sep 17 00:00:00 2001 From: Jonathan Kew Date: Tue, 3 Apr 2012 12:22:18 +0100 Subject: [PATCH] bug 717175 - flush shaped-word caches if they grow excessively large. r=roc --- gfx/thebes/gfxFont.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index 5c6ef0eb4dff..be9dfeab53c1 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -2129,6 +2129,12 @@ gfxFont::GetShapedWord(gfxContext *aContext, PRInt32 aAppUnitsPerDevUnit, PRUint32 aFlags) { + // if the cache is getting too big, flush it and start over + if (mWordCache.Count() > 10000) { + NS_WARNING("flushing shaped-word cache"); + ClearCachedWords(); + } + // if there's a cached entry for this word, just return it CacheHashKey key(aText, aLength, aHash, aRunScript,