Bug 233328 - ANGLE Metal: The memory backing IOSurfaces of former client buffer pbuffers is leaked
Summary: ANGLE Metal: The memory backing IOSurfaces of former client buffer pbuffers i...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kimmo Kinnunen
URL:
Keywords: InRadar
Depends on:
Blocks: 234356
  Show dependency treegraph
 
Reported: 2021-11-18 12:27 PST by Kimmo Kinnunen
Modified: 2021-12-17 16:36 PST (History)
11 users (show)

See Also:


Attachments
Patch (23.83 KB, patch)
2021-11-24 04:53 PST, Kimmo Kinnunen
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch (26.46 KB, patch)
2021-11-24 05:50 PST, Kimmo Kinnunen
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
Patch for landing (26.46 KB, patch)
2021-11-24 06:08 PST, Kimmo Kinnunen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kimmo Kinnunen 2021-11-18 12:27:02 PST
ANGLE Metal: The memory backing IOSurfaces of former client buffer pbuffers is leaked

This affects mainly WebGL GPU process.

To repro:
Set "WebGL via Metal" and "GPU Process: WebGL"
Navigate to https://webglsamples.org/aquarium/aquarium.html and observe GPUP memory consumption go up.

footprint $(pgrep GPU.Development)
 
GPU Process uses m_context->markDisplayBufferInUse(); to destroy each WebGL drawing buffer PBuffer before sending the IOSurface to WebContent process for compositing.
This should detach the IOSurface from the EGL pbuffer and as such the pbuffer from the GL texture.

Somehow the memory is still leaking through GPU process.

Note: 
This leaking memory is leaked as "something something graphics memory" (via footprint tool).

Normal IOSurfaces are marked as "IOSurface" by footprint.

The leak doesn't exist in OpenGL backend.
Comment 1 Radar WebKit Bug Importer 2021-11-18 12:32:48 PST
<rdar://problem/85563187>
Comment 2 Kenneth Russell 2021-11-18 18:49:18 PST
Yikes. Please tell us if it looks like this leak is inside ANGLE.
Comment 3 Kimmo Kinnunen 2021-11-24 04:53:09 PST
Created attachment 445088 [details]
Patch
Comment 4 Kimmo Kinnunen 2021-11-24 05:50:21 PST
Created attachment 445092 [details]
Patch
Comment 5 Kimmo Kinnunen 2021-11-24 06:08:25 PST
Created attachment 445096 [details]
Patch for landing
Comment 6 Kimmo Kinnunen 2021-11-25 00:59:06 PST
> Yikes. Please tell us if it looks like this leak is inside ANGLE.
No, this one was in WebKit, one of my added features.
Comment 7 EWS 2021-11-25 01:17:53 PST
Committed r286160 (244544@main): <https://commits.webkit.org/244544@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 445096 [details].