Post

Replies

Boosts

Views

Activity

Resizing on-screen WebGL canvas in iOS Safari causes memory leak
This is specific to iOS Safari or a WebKit-powered application on iOS. If you have an HTML canvas on-screen that renders using a WebGL context, memory will leak when you resize that canvas’ width and height properties. This behavior does not happen on any desktop browser. I made a barebones example using jsfiddle which reproduces the issue on iOS Safari. However, I am unable to include that link in this post. That 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). 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?
3
0
3.4k
Dec ’20