<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:clopez&#64;igalia.com" title="Carlos Alberto Lopez Perez &lt;clopez&#64;igalia.com&gt;"> <span class="fn">Carlos Alberto Lopez Perez</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Decoding of animated PNG (APNG) is not optimized for memory usage."
   href="https://bugs.webkit.org/show_bug.cgi?id=146205">bug 146205</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">URL</td>
           <td>
               &nbsp;
           </td>
           <td>http://people.igalia.com/clopez/apngmem
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Decoding of animated PNG (APNG) is not optimized for memory usage."
   href="https://bugs.webkit.org/show_bug.cgi?id=146205#c1">Comment # 1</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Decoding of animated PNG (APNG) is not optimized for memory usage."
   href="https://bugs.webkit.org/show_bug.cgi?id=146205">bug 146205</a>
              from <span class="vcard"><a class="email" href="mailto:clopez&#64;igalia.com" title="Carlos Alberto Lopez Perez &lt;clopez&#64;igalia.com&gt;"> <span class="fn">Carlos Alberto Lopez Perez</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=146205#c0">comment #0</a>)
<span class="quote">&gt; The current code for decoding animated PNGs (see <a class="bz_bug_link 
          bz_status_RESOLVED  bz_closed"
   title="RESOLVED FIXED - Add APNG support"
   href="show_bug.cgi?id=17022">bug 17022</a>.) decodes all
&gt; frames at once
&gt; and loads the raw pixels on memory for each frame.
&gt; 
&gt; This is a problem when we have an animated PNG with many frames.
&gt; 
&gt; Take the following example:
&gt; 
&gt; <a href="http://people.igalia.com/clopez/apngmem">http://people.igalia.com/clopez/apngmem</a>
&gt; 
&gt; The image loaded (clouds.png) has 375 frames at 700 x 394 (8-bit/color RGBA),
&gt; so when each frame of this image is loaded into memory it uses:
&gt; 
&gt; 700*394*4 ~ 1.05 MB
&gt; 
&gt; That should be ok if the image had only a few frames, however it has 375
&gt; frames,
&gt; so when we load all the 375 frames into memory we end using around ~400MB,
&gt; which is too much.
&gt; </span >
&gt;

I have replaced the previous examples with one that includes the same test with gif and apng because is much clearer the issue.

Now if you load <a href="http://people.igalia.com/clopez/apngmem">http://people.igalia.com/clopez/apngmem</a> you see there two test pages, the one with gif and the another one with apng.

On the one with gif WebKitWebProcess only uses ~110MB in total, on the one with apng it peaks at ~ 3GB of RAM, and as the animation is playing the memory usage starts to lower (because PNGImageDecoder::clearFrameBufferCache() is starting to clear already played frames), but when the animation finish and it starts again the memory usage peaks again at 3GB of RAM because we load all frames into memory.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>