Created attachment 412291 [details] memory leak log Test environment: iPad6 iOS 14 I have a sample html with a iframe in it.Each time the iframe switch from webgl page to blank,memory leak occurs.Repeat this safari will finally crash and reload. Safari memory usage can be seen from perfdog(perfdog.wetest.net).Note: filter process to "com.apple.WebKit.WebContent". Attach is memory leak log pic. Test iframe page: <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> * { box-sizing: border-box; } /* Create two equal columns that floats next to each other */ .column { float: left; width: 80%; padding: 10px; height: 600px; /* Should be removed. Only for demonstration */ } .column2 { float: left; width: 20%; padding: 10px; height: 600px; /* Should be removed. Only for demonstration */ } /* Clear floats after the columns */ .row:after { content: ""; clear: both; } </style> </head> <body> <script> function htmlToElement(html) { var template = document.createElement('template'); html = html.trim(); // Never return a text node of whitespace as the result template.innerHTML = html; return template.content.firstChild; } function createIframeIfNotExists() { let iframe = document.getElementById("iframe"); if (!iframe) { const deviceLostHtmlString = ` <iframe id="iframe" src="" width="100%" height="100%" title="Iframe Example"></iframe> `; iframe = htmlToElement(deviceLostHtmlString); document.getElementById("iframe_parent").appendChild(iframe); } return iframe; } function toWebgl() { createIframeIfNotExists().src = "https://webglsamples.org/aquarium/aquarium.html"; } function toBlank() { let iframe = document.getElementById("iframe"); if (iframe) { iframe.src = "about:blank"; // iframe.contentWindow.document.write(''); // iframe.contentWindow.document.clear(); // iframe.parentNode.removeChild(iframe); } } function toGitee() { createIframeIfNotExists().src = "https://gitee.com"; } </script> <h2>Two Equal Columns</h2> <div class="row"> <div id="iframe_parent" class="column" style="background-color:#aaa;"> <!-- <iframe id="iframe" src="" width="100%" height="100%" title="Iframe Example"></iframe> --> </div> <div class="column2" style="background-color:#bbb;"> <button onclick="toBlank()">about:blank</button> <button onclick="toWebgl()">WebGL sample</button> <button onclick="toGitee()">gitee</button> </div> </div> </body> </html>
Created attachment 412354 [details] Test Case
Thanks for filing, I have not been able to reproduce this so far with the attached test case on iOS 14.0 or the 14.2 beta. Aside from switching back and forth between the webGL demo and about:blank repeatedly, is there anything else required to reproduce this? I also tried to increase the number of elements drawn in the demo each time but did not encounter a crash.
<rdar://problem/70695521>
(In reply to Smoley from comment #2) > Thanks for filing, I have not been able to reproduce this so far with the > attached test case on iOS 14.0 or the 14.2 beta. > > Aside from switching back and forth between the webGL demo and about:blank > repeatedly, is there anything else required to reproduce this? I also tried > to increase the number of elements drawn in the demo each time but did not > encounter a crash. I revised the test method: Open web page https://bugs.webkit.org/attachment.cgi?id=412354 in safari.And use XCode Instruments' Activity Monitor to view the safari's memory usage. Attachments are memory usage of: The first time open test web page. The First time open "WebGL Sample" page. After switch from "WebGL sample" to "about:blank" 30 times. After switch from "WebGL sample" to "about:blank" 30 times, and wait 2 minutes.
Created attachment 412501 [details] XCode Instruments' Activity Monitor view of the first time open test web page.
Created attachment 412502 [details] XCode Instruments' Activity Monitor view of the first time open "WebGL Sample" page.
Created attachment 412503 [details] XCode Instruments' Activity Monitor view after switch from "WebGL sample" to "about:blank" 30 times.
Created attachment 412504 [details] XCode Instruments' Activity Monitor view after switch from "WebGL sample" to "about:blank" 30 times, and wait 2 minutes.
And as memory continually increase, the webcontent process will eventually crash, but safari will refresh the page and recreate webcontent process.
Thanks for reporting. We have changed a bit how WebGL manages the back buffers in trunk. It was reported in bug 217212 that this work did fix some leaks.