RESOLVED DUPLICATE of bug 187964 Bug 229825
Memory Leak when using createImageBitmap() in Safari 15 (iOS)
https://bugs.webkit.org/show_bug.cgi?id=229825
Summary Memory Leak when using createImageBitmap() in Safari 15 (iOS)
Wayne Langman
Reported 2021-09-02 12:54:04 PDT
Created attachment 437185 [details] Code and Screenshots While testing some of our games in iOS 15 (including the latest beta 8) we encountered some strange behaviour that I've narrowed down to createImageBitmap(). I've investigated this in Instruments, on an iPhone 7 and an iPhone 12, and it appears that the textures aren't being released from memory, which affects not only the current tab but all browser tabs (see the screenshot provided). Please see the sample code provided which reproduces this issue. The code will load 30x 2k textures via createImageBitmap(). Depending on your device and how much memory it has, if you open up another 1/2 tabs and load the same demo, and/or continuously refresh, you'll start to notice the occasional flicker of missing, or sometimes black, textures and eventually the tab crashes. Also, whether uploading 1 texture per animation frame or staggered over longer periods the result is the same. This can be reproduced using the default experimental features but when disabling the canvas rendering process it behaves a little differently (from what I can tell). It may appear at first to resolve the issue but in fact only alleviates the missing/black textures and still leaks memory, eventually crashes the tab. In our engine we use createImageBitmap() for supported browsers and otherwise use a polyfill (e.g. previous releases of Safari). In the meantime we've implemented a workaround to bypass this on iOS and always fall back to the polyfill. The sample code includes this fallback and does not display any of these issues. On a side note: I see that createImageBitmap() was added to Safar 11 Technical Preview in November 2017 but am I correct in assuming that it has never actually made its way into release?
Attachments
Code and Screenshots (157.81 KB, application/zip)
2021-09-02 12:54 PDT, Wayne Langman
no flags
Wayne Langman
Comment 1 2021-09-02 13:08:22 PDT
Actually, in addition to my side note, is this even going to land in the Safari 15 release?
Wayne Langman
Comment 2 2021-09-02 13:22:47 PDT
And I just realised that there is a toggle for ImageBitmap under experimental features ...
Radar WebKit Bug Importer
Comment 3 2021-09-02 16:10:46 PDT
Dean Jackson
Comment 4 2021-09-02 16:11:09 PDT
Thanks for the test case and detailed report!
Wayne Langman
Comment 5 2024-11-01 02:57:08 PDT
Was this ever resolved?
Simon Fraser (smfr)
Comment 6 2024-11-01 09:53:33 PDT
It was fixed via bug 187964. *** This bug has been marked as a duplicate of bug 187964 ***
Note You need to log in before you can comment on or make changes to this bug.