<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>111443</bug_id>
          
          <creation_ts>2013-03-05 08:29:36 -0800</creation_ts>
          <short_desc>[Qt][WK1] MemoryCache is not cleaned by default</short_desc>
          <delta_ts>2013-04-23 01:32:19 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit Qt</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Allan Sandfeld Jensen">allan.jensen</reporter>
          <assigned_to name="Allan Sandfeld Jensen">allan.jensen</assigned_to>
          <cc>ararunprasad</cc>
    
    <cc>arurajku</cc>
    
    <cc>hausmann</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>847705</commentid>
    <comment_count>0</comment_count>
    <who name="Allan Sandfeld Jensen">allan.jensen</who>
    <bug_when>2013-03-05 08:29:36 -0800</bug_when>
    <thetext>By default the MemoryCache does not remove dead resources, this only happens if setDeadDecodedDataDeletionInterval() has been called. In WK2 we do this in WebProcess based on the CacheModel, but in WK1 we only do it based on an undocumented dynamic property calle _q_deadDecodedDataDeletionInterval.

By default we should enable cleaning of the memoryCache as long as it is enabled following the setting of WK2.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>847709</commentid>
    <comment_count>1</comment_count>
      <attachid>191502</attachid>
    <who name="Allan Sandfeld Jensen">allan.jensen</who>
    <bug_when>2013-03-05 08:33:17 -0800</bug_when>
    <thetext>Created attachment 191502
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>847735</commentid>
    <comment_count>2</comment_count>
    <who name="Arunprasad">ararunprasad</who>
    <bug_when>2013-03-05 09:12:56 -0800</bug_when>
    <thetext>Is it really needed? Because QWebPage has a dynamic property(_q_deadDecodedDataDeletionInterval) to tune this as mentioned by you. Also if we have a room for dead decoded data in the MemoryCache why should we delete the dead decoded data? Incase of cache pressure first it will remove all the dead decoded data from the MemoryCache.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>847751</commentid>
    <comment_count>3</comment_count>
    <who name="Allan Sandfeld Jensen">allan.jensen</who>
    <bug_when>2013-03-05 09:37:45 -0800</bug_when>
    <thetext>(In reply to comment #2)
&gt; Is it really needed? Because QWebPage has a dynamic property(_q_deadDecodedDataDeletionInterval) to tune this as mentioned by you. Also if we have a room for dead decoded data in the MemoryCache why should we delete the dead decoded data? Incase of cache pressure first it will remove all the dead decoded data from the MemoryCache.

Note we do not have memory pressure events in QtWebKit. Only Mac uses those. Keeping dead things out of memory means that we are less of a burden to the operating system, and less likely to have something we actually need swapped out. Plus it makes everything else faster if the operating system has more free memory.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>847763</commentid>
    <comment_count>4</comment_count>
    <who name="Arunprasad">ararunprasad</who>
    <bug_when>2013-03-05 09:53:40 -0800</bug_when>
    <thetext>(In reply to comment #3)
&gt; (In reply to comment #2)
&gt; &gt; Is it really needed? Because QWebPage has a dynamic property(_q_deadDecodedDataDeletionInterval) to tune this as mentioned by you. Also if we have a room for dead decoded data in the MemoryCache why should we delete the dead decoded data? Incase of cache pressure first it will remove all the dead decoded data from the MemoryCache.
&gt; 
&gt; Note we do not have memory pressure events in QtWebKit. Only Mac uses those. Keeping dead things out of memory means that we are less of a burden to the operating system, and less likely to have something we actually need swapped out. Plus it makes everything else faster if the operating system has more free memory.

Yes. We don&apos;t have memory pressure events. Suppose WebCore requests a new resource then MemoryCache will be audited to ensure whether it has enough space, if it don&apos;t have then it starts purging the things from DeadDecoded resource to Live Resources which is used long back(based on LRU). It is not a kind of event, but it is like a checking for the room before adding new resources. :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>849997</commentid>
    <comment_count>5</comment_count>
    <who name="Allan Sandfeld Jensen">allan.jensen</who>
    <bug_when>2013-03-07 05:39:29 -0800</bug_when>
    <thetext>(In reply to comment #4)
&gt; (In reply to comment #3)
&gt; &gt; (In reply to comment #2)
&gt; &gt; &gt; Is it really needed? Because QWebPage has a dynamic property(_q_deadDecodedDataDeletionInterval) to tune this as mentioned by you. Also if we have a room for dead decoded data in the MemoryCache why should we delete the dead decoded data? Incase of cache pressure first it will remove all the dead decoded data from the MemoryCache.
&gt; &gt; 
&gt; &gt; Note we do not have memory pressure events in QtWebKit. Only Mac uses those. Keeping dead things out of memory means that we are less of a burden to the operating system, and less likely to have something we actually need swapped out. Plus it makes everything else faster if the operating system has more free memory.
&gt; 
&gt; Yes. We don&apos;t have memory pressure events. Suppose WebCore requests a new resource then MemoryCache will be audited to ensure whether it has enough space, if it don&apos;t have then it starts purging the things from DeadDecoded resource to Live Resources which is used long back(based on LRU). It is not a kind of event, but it is like a checking for the room before adding new resources. :)

True, but imagine you have a large memory cache setup the way we do WK2. 128 Mbyte total with a maxDeadbytes of 64MByte. Every time the cache reached 128, it will be pruned to 64, and then slowly grow again back to 128Mbyte. If this patch was applied it woul instead be pruned every minute to try to hit the target of 64mbyte cache in use.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>850007</commentid>
    <comment_count>6</comment_count>
    <who name="Arunprasad">ararunprasad</who>
    <bug_when>2013-03-07 05:55:42 -0800</bug_when>
    <thetext>&gt; True, but imagine you have a large memory cache setup the way we do WK2. 128 Mbyte total with a maxDeadbytes of 64MByte. Every time the cache reached 128, it will be pruned to 64, and then slowly grow again back to 128Mbyte. If this patch was applied it woul instead be pruned every minute to try to hit the target of 64mbyte cache in use.

Yeah!. So by default it is 1 minute, if the library user wants then they can override using _q_deadDecodedDataDeletionInterval.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>879058</commentid>
    <comment_count>7</comment_count>
      <attachid>191502</attachid>
    <who name="Jocelyn Turcotte">jturcotte</who>
    <bug_when>2013-04-22 03:34:10 -0700</bug_when>
    <thetext>Comment on attachment 191502
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=191502&amp;action=review

&gt; Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp:108
&gt; +        WebCore::memoryCache()-&gt;setDeadDecodedDataDeletionInterval(60);

If you can think of any way to avoid hard-coding this value in two different files it would be nice.
I can&apos;t think of any simple way so r=me in any case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>879064</commentid>
    <comment_count>8</comment_count>
    <who name="Allan Sandfeld Jensen">allan.jensen</who>
    <bug_when>2013-04-22 03:48:38 -0700</bug_when>
    <thetext>(In reply to comment #7)
&gt; (From update of attachment 191502 [details])
&gt; View in context: https://bugs.webkit.org/attachment.cgi?id=191502&amp;action=review
&gt; 
&gt; &gt; Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp:108
&gt; &gt; +        WebCore::memoryCache()-&gt;setDeadDecodedDataDeletionInterval(60);
&gt; 
&gt; If you can think of any way to avoid hard-coding this value in two different files it would be nice.
&gt; I can&apos;t think of any simple way so r=me in any case.

Ideally we would expose an API to set the cacheModel, just like WK2 and the other ports does.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>879675</commentid>
    <comment_count>9</comment_count>
    <who name="Allan Sandfeld Jensen">allan.jensen</who>
    <bug_when>2013-04-23 01:32:19 -0700</bug_when>
    <thetext>Committed r148951: &lt;http://trac.webkit.org/changeset/148951&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>191502</attachid>
            <date>2013-03-05 08:33:17 -0800</date>
            <delta_ts>2013-04-22 03:34:09 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-111443-20130305172834.patch</filename>
            <type>text/plain</type>
            <size>2571</size>
            <attacher name="Allan Sandfeld Jensen">allan.jensen</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMTQ0NjI3CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViS2l0L3F0
L0NoYW5nZUxvZyBiL1NvdXJjZS9XZWJLaXQvcXQvQ2hhbmdlTG9nCmluZGV4IDkzN2ZhOTE5NWVl
ZDRiOGE3YTc0MDY5NmRhNjE0N2Q0MjE5NDAwMTUuLmU1YTUyNDE3NDAxNzVhNmU4ZjAyMWY5YzA3
MTdiOTNkMjAxMDA2MmMgMTAwNjQ0Ci0tLSBhL1NvdXJjZS9XZWJLaXQvcXQvQ2hhbmdlTG9nCisr
KyBiL1NvdXJjZS9XZWJLaXQvcXQvQ2hhbmdlTG9nCkBAIC0xLDMgKzEsMjAgQEAKKzIwMTMtMDMt
MDUgIEFsbGFuIFNhbmRmZWxkIEplbnNlbiAgPGFsbGFuLmplbnNlbkBkaWdpYS5jb20+CisKKyAg
ICAgICAgW1F0XVtXSzFdIE1lbW9yeUNhY2hlIGlzIG5vdCBjbGVhbmVkIGJ5IGRlZmF1bHQKKyAg
ICAgICAgaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcuY2dpP2lkPTExMTQ0MworCisg
ICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09QUyEpLgorCisgICAgICAgIEVuYWJsZSBkZWxl
dGlvbiBvZiBkZWFkIHJlc291cmNlcyBpbiB0aGUgbWVtb3J5IGNhY2hlIGFzIGxvbmcgYXMgdGhl
IE1lbW9yeUNhY2hlIGlzIGVuYWJsZWQuCisKKyAgICAgICAgVGhpcyBjYW4gYmUgZGlzYWJsZWQg
b3IgdHVuZWQgdXNpbmcgdGhlIG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1ZGUgIk5vdEltcGxlbWVudGVkLmgiCiAjaW5jbHVkZSAiUGFnZS5oIgogI2luY2x1ZGUgIlBs
YXRmb3JtU3RyYXRlZ2llc1F0LmgiCkBAIC0xMDMsNiArMTA0LDggQEAgUV9ERUNMX0VYUE9SVCB2
b2lkIGluaXRpYWxpemVXZWJDb3JlUXQoKQogI2lmIFVTRShRVEtJVCkKICAgICBJbml0V2ViQ29y
ZVN5c3RlbUludGVyZmFjZSgpOwogI2VuZGlmCisgICAgaWYgKCFXZWJDb3JlOjptZW1vcnlDYWNo
ZSgpLT5kaXNhYmxlZCgpKQorICAgICAgICBXZWJDb3JlOjptZW1vcnlDYWNoZSgpLT5zZXREZWFk
RGVjb2RlZERhdGFEZWxldGlvbkludGVydmFsKDYwKTsKIAogICAgIGluaXRpYWxpemVkID0gdHJ1
ZTsKIH0K
</data>
<flag name="review"
          id="212485"
          type_id="1"
          status="+"
          setter="jturcotte"
    />
          </attachment>
      

    </bug>

</bugzilla>