Title: [131209] trunk/Source/WebCore
Revision
131209
Author
[email protected]
Date
2012-10-12 12:19:38 -0700 (Fri, 12 Oct 2012)

Log Message

REGRESSION: Rapid memory growth calling DOM APIs with large strings.
<http://webkit.org/b/98498>
<rdar://problem/12443926>

Reviewed by Geöff Gären and Änders Cärlssön.

Prevent the selector query cache from growing indefinitely by setting a relaxed limit of 256 entries.
If the cache fills up, remove a random entry before inserting a new one.

While this is unlikely to be a problem on real websites, we definitely shouldn't be adding boundless
caches to WebKit.

* dom/SelectorQuery.cpp:
(WebCore::SelectorQueryCache::add):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (131208 => 131209)


--- trunk/Source/WebCore/ChangeLog	2012-10-12 19:09:50 UTC (rev 131208)
+++ trunk/Source/WebCore/ChangeLog	2012-10-12 19:19:38 UTC (rev 131209)
@@ -1,3 +1,20 @@
+2012-10-12  Andreas Kling  <[email protected]>
+
+        REGRESSION: Rapid memory growth calling DOM APIs with large strings.
+        <http://webkit.org/b/98498>
+        <rdar://problem/12443926>
+
+        Reviewed by Geöff Gären and Änders Cärlssön.
+
+        Prevent the selector query cache from growing indefinitely by setting a relaxed limit of 256 entries.
+        If the cache fills up, remove a random entry before inserting a new one.
+
+        While this is unlikely to be a problem on real websites, we definitely shouldn't be adding boundless
+        caches to WebKit.
+
+        * dom/SelectorQuery.cpp:
+        (WebCore::SelectorQueryCache::add):
+
 2012-10-12  Roger Fong  <[email protected]>
 
         Update method signature for platformCALayerShowRepaintCounter in MediaPlayerPlayerPrivateAVFoundationCF's LayerClient class.

Modified: trunk/Source/WebCore/dom/SelectorQuery.cpp (131208 => 131209)


--- trunk/Source/WebCore/dom/SelectorQuery.cpp	2012-10-12 19:09:50 UTC (rev 131208)
+++ trunk/Source/WebCore/dom/SelectorQuery.cpp	2012-10-12 19:19:38 UTC (rev 131209)
@@ -190,6 +190,10 @@
         ec = NAMESPACE_ERR;
         return 0;
     }
+
+    const int maximumSelectorQueryCacheSize = 256;
+    if (m_entries.size() == maximumSelectorQueryCacheSize)
+        m_entries.remove(m_entries.begin());
     
     OwnPtr<SelectorQuery> selectorQuery = adoptPtr(new SelectorQuery(selectorList));
     SelectorQuery* rawSelectorQuery = selectorQuery.get();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to