GPU memory leak uploading OffscreenCanvas to WebGL texture
Reported by
a...@scirra.com,
Oct 22
|
||||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.67 Safari/537.36 Steps to reproduce the problem: Our framework Construct 3 has started using OffscreenCanvas. We discovered a memory leak involving uploading OffscreenCanvas to a WebGL texture. Our framework renders text in a WebGL game by first drawing text on a 2D canvas, uploading the canvas to a texture, and then drawing a quad with the texture. Switching the DOM canvas to an OffscreenCanvas, and inserting a call to transferToImageBitmap() (which used to be necessary since direct upload of OffscreenCanvas was not originally supported), results in endlessly increasing GPU memory until it kills the WebGL context. To reproduce simply open the following URL, maximise the window (to reproduce quicker), and observe GPU memory in Chrome's task manager: https://www.scirra.com/labs/bugs/gpumemleak/offscreencanvas/index.html What is the expected behavior? Compare to identical code but using DOM canvas instead: https://www.scirra.com/labs/bugs/gpumemleak/domcanvas/index.html This does not leak. What went wrong? The OffscreenCanvas version leaks GPU memory. Did this work before? N/A Does this work in other browsers? N/A Chrome version: 70.0.3538.67 Channel: stable OS Version: 10.0 Flash Version: Removing the now-unnecessary call to transferToImageBitmap() also avoids the memory leak. However there should not be a memory leak even with the call to transferToImageBitmap().
,
Oct 22
,
Oct 24
,
Oct 25
,
Oct 26
Both GC issues are fixed, sending the actual ImageBitmap fix now: https://chromium-review.googlesource.com/c/chromium/src/+/1297067 stay tuned.
,
Oct 29
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/754c97a74b5f84f5d7291c330dc23681cf600cfe commit 754c97a74b5f84f5d7291c330dc23681cf600cfe Author: Fernando Serboncini <fserb@chromium.org> Date: Mon Oct 29 16:57:22 2018 Record GPU memory usage for OffscreenCanvas/ImageBitmap on V8 this allows V8 to know when we are using too much memory, which triggers a GC. Bug: 897733 , 842693 Change-Id: I74c7589ab78a753132e54d5eac3c28793580c266 Reviewed-on: https://chromium-review.googlesource.com/c/1297067 Commit-Queue: Fernando Serboncini <fserb@chromium.org> Reviewed-by: Mohammad Reza Zakerinasab <zakerinasab@chromium.org> Cr-Commit-Position: refs/heads/master@{#603527} [modify] https://crrev.com/754c97a74b5f84f5d7291c330dc23681cf600cfe/third_party/blink/renderer/core/html/canvas/html_canvas_element.cc [modify] https://crrev.com/754c97a74b5f84f5d7291c330dc23681cf600cfe/third_party/blink/renderer/core/imagebitmap/image_bitmap.cc [modify] https://crrev.com/754c97a74b5f84f5d7291c330dc23681cf600cfe/third_party/blink/renderer/core/imagebitmap/image_bitmap.h [modify] https://crrev.com/754c97a74b5f84f5d7291c330dc23681cf600cfe/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.cc [modify] https://crrev.com/754c97a74b5f84f5d7291c330dc23681cf600cfe/third_party/blink/renderer/core/offscreencanvas/offscreen_canvas.h
,
Oct 29
Donerine! :)
,
Oct 30
Able to reproduce the issue on chrome reported version 67.0.3538.67 Verified the fix using Windows-10 on Chrome version #72.0.3596.0 as per the comment#0 Attaching screen cast for reference. Observed "NO GPU memory leakage on chrome Task Manager" Hence, the fix is working as expected. Adding the verified label. Thanks! |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by fs...@chromium.org
, Oct 22Labels: -Pri-2 Pri-1
Status: Available (was: Unconfirmed)