From pub...@ Fri Dec 11 13:21:34 2020 From: pub...@ (Mark Schlosser (...@...)) Date: Fri, 11 Dec 2020 16:21:34 -0500 Subject: [Public WebGL] Resizing on-screen WebGL canvas in iOS Safari causes memory leak Message-ID: I filed a bug about this at bugs.webkit.org, but I wanted to also try to gather some feedback on this mailing list. I have an HTML canvas on-screen that renders using a WebGL context; memory will leak when I resize that canvas? width and height properties in iOS Safari. This behavior does not happen on any desktop browser. I made a barebones example using jsfiddle which reproduces the issue on iOS Safari: https://jsfiddle.net/fjbn9qk4/ To render the example at full screen on a device, use this link: https://jsfiddle.net/fjbn9qk4/show The example automatically resizes a WebGL canvas every 1 second using two different sets of dimensions. Every frame it renders a quad ? all I do is call a handful of GL routines to get the quad on the screen (I do not create any new GL objects explicitly after the initial setup). This issue can also be reproduced if the example is made to simply respond to resizing and I rotate the orientation of the device back and forth from portrait to landscape. When this sample runs on Safari iOS on an iPad Air 3 running iOS 14.2, Safari page memory usage steadily increases every resize. After letting it run for a while, the browser process gets terminated after it reaches 1.25GB memory. It started at less than 300MB. If I run this same example in a desktop browser, the memory usage is steady the entire time. The issue appears to be limited to canvases that use WebGL contexts. Canvases using 2D rendering contexts appear unaffected. Anyone else seeing this or know of a workaround? Rendering to an offscreen WebGL canvas and using drawImage() to transport it to an on-screen 2d canvas is a solution, but I see lower performance in some browsers, including iOS Safari. The webkit bug I filed is here: https://bugs.webkit.org/show_bug.cgi?id=219780 ----------------------------------------------------------- You are currently subscribed to public_webgl...@ To unsubscribe, send an email to majordomo...@ with the following command in the body of your email: unsubscribe public_webgl ----------------------------------------------------------- From pub...@ Fri Dec 11 15:47:56 2020 From: pub...@ (Ken Russell (...@...)) Date: Fri, 11 Dec 2020 15:47:56 -0800 Subject: [Public WebGL] Resizing on-screen WebGL canvas in iOS Safari causes memory leak In-Reply-To: References: Message-ID: Hi Mark, Thanks for reporting the bug. I triaged https://bugs.webkit.org/show_bug.cgi?id=219780 ; I think this issue was already discovered and fixed, and that a fix is forthcoming in a future iOS 14 release. Please watch the bug for more updates. The workaround you found is the best one I can think of. If you do implement it, please make sure you can easily disable it, because the fix is on the way. Thanks, -Ken On Fri, Dec 11, 2020 at 1:22 PM Mark Schlosser (msatbentley...@) < public_webgl...@> wrote: > > I filed a bug about this at bugs.webkit.org, but I wanted to also try > to gather some feedback on this mailing list. > > I have an HTML canvas on-screen that renders using a WebGL context; > memory will leak when I resize that canvas? width and height > properties in iOS Safari. This behavior does not happen on any desktop > browser. > > I made a barebones example using jsfiddle which reproduces the issue > on iOS Safari: https://jsfiddle.net/fjbn9qk4/ > To render the example at full screen on a device, use this link: > https://jsfiddle.net/fjbn9qk4/show > > The example automatically resizes a WebGL canvas every 1 second using > two different sets of dimensions. Every frame it renders a quad ? all > I do is call a handful of GL routines to get the quad on the screen (I > do not create any new GL objects explicitly after the initial setup). > This issue can also be reproduced if the example is made to simply > respond to resizing and I rotate the orientation of the device back > and forth from portrait to landscape. > > When this sample runs on Safari iOS on an iPad Air 3 running iOS 14.2, > Safari page memory usage steadily increases every resize. After > letting it run for a while, the browser process gets terminated after > it reaches 1.25GB memory. It started at less than 300MB. > > If I run this same example in a desktop browser, the memory usage is > steady the entire time. > > The issue appears to be limited to canvases that use WebGL contexts. > Canvases using 2D rendering contexts appear unaffected. > > Anyone else seeing this or know of a workaround? > > Rendering to an offscreen WebGL canvas and using drawImage() to > transport it to an on-screen 2d canvas is a solution, but I see lower > performance in some browsers, including iOS Safari. > > The webkit bug I filed is here: > https://bugs.webkit.org/show_bug.cgi?id=219780 > > ----------------------------------------------------------- > You are currently subscribed to public_webgl...@ > To unsubscribe, send an email to majordomo...@ with > the following command in the body of your email: > unsubscribe public_webgl > ----------------------------------------------------------- > > -- I support flexible work schedules, and I?m sending this email now because it is within the hours I?m working today. Please do not feel obliged to reply straight away - I understand that you will reply during the hours you work, which may not match mine. (credit: jparent@) -------------- next part -------------- An HTML attachment was scrubbed... URL: