WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
REOPENED
275331
[CG] An Image with video source may allocate too much memory for caching all the video frames
https://bugs.webkit.org/show_bug.cgi?id=275331
Summary
[CG] An Image with video source may allocate too much memory for caching all ...
Said Abou-Hallawa
Reported
2024-06-10 13:56:10 PDT
If a video has at least hundreds of frames and the size of each frame is large, one image like this <img src="video.mp4"> may allocate multiple of gigabytes. ImageDecoderAVFObjC::createFrameImageAtIndex() decodes a frame of the video and returns a CGImage for this frame. But it caches the returned CGImage also to avoid decoding it multiple times. Unfortunately this is not how decoding the animated image works. BitmapImageSource manages the cache of the decoded frames and under memory pressure BitmapImageSource::destroyDecodedData() releases all frames which it does not need to render the current frame. BitmapImageSource::destroyDecodedData() calls also ImageDecoderAVFObjC::clearFrameBufferCache() to let it release any cached data. But the caches in BitmapImageSource and ImageDecoderAVFObjC can get of sync because BitmapImageSource does not communicate what frames it actually released. So ImageDecoderAVFObjC may end up holding many CGImages BitmapImageSource does not know anything about. ImageDecoderAVFObjC should not cache any decoded frame. ImageDecoderAVFObjC::clearFrameBufferCache() should be just an empty function.
Attachments
Add attachment
proposed patch, testcase, etc.
Said Abou-Hallawa
Comment 1
2024-06-10 13:56:44 PDT
rdar://126993116
Said Abou-Hallawa
Comment 2
2024-06-10 14:11:49 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/29688
EWS
Comment 3
2024-06-11 15:14:38 PDT
Committed
279926@main
(22ed0bf86c1f): <
https://commits.webkit.org/279926@main
> Reviewed commits have been landed. Closing PR #29688 and removing active labels.
WebKit Commit Bot
Comment 4
2024-07-08 08:53:31 PDT
Re-opened since this is blocked by
bug 276319
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug