Resizing a webGL context on (at least some) Intel graphics macs causes a memory leak

Originator:kevineschmidt
Number:rdar://29246530 Date Originated:11/16/2016
Status:Open Resolved:
Product:macOS Product Version:
Classification: Reproducible:Yes
 
Summary:
When resizing a webgl context on a MacBook (Pro, air) with ONLY integrated intel graphics (several different versions have been tested), memory seems to leak.  This has been tested in multiple browsers (Safari, Chrome, Firefox), leading me to believe it could be a leak in the integrated graphics driver using system memory.
<< code >>
                        var container = document.getElementById("container");
                        var canvas = document.createElement("canvas");
                        container.appendChild(canvas);
                        canvas.width = 500;
                        canvas.height = 500;
                        var delta = 100;
                        canvas.getContext("webgl")
                        animate();
                        function animate() {

                                requestAnimationFrame( animate );
                                canvas.width += delta;
                                canvas.style.width = canvas.width;
                                canvas.style.height = canvas.height;
                                delta *= -1
                        }

<< end code >>


Steps to Reproduce:
1.  Open Activity Monitor, and switch to the memory tab
2.  Ensure the Memory Used line at the bottom stays visible during the test
3.  Open the web page in the attached tarball in a browser
4.  The Memory Used line grows very rapidly, until it gets close to physical memory, at which point compressed memory begins growing.  Eventually this can cause the browser to crash.  This memory usage does not seem to be attributed to the specific browser process.

Expected Results:
I expect memory to remain stable and the browser to not crash

Actual Results:
4.  The Memory Used line grows very rapidly, until it gets close to physical memory, at which point compressed memory begins growing.  Eventually this can cause the browser to crash.

Version:
Tested on 10.10 -> 10.12.  I am currently running on a macbook air using 10.11.6 (15G31)

Notes:


Configuration:
This seems to be tied to Intel integrated graphics across all recent versions of OSX we managed to test ( a customer tested Sierra ).

My MacBook Pro that has NVidia + Intel graphics, the browser never crashes and I don't seem memory creep.  I also attempted to use the program gfxCardStatus to lock it to the Intel, but I still did not see the problem.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!