RESOLVED FIXED 264971
ScriptBuffer append with empty string adds empty segment
https://bugs.webkit.org/show_bug.cgi?id=264971
Summary ScriptBuffer append with empty string adds empty segment
Cristian Linte
Reported 2023-11-16 11:58:59 PST
ScriptBufferSourceProvider sometimes receives a ScriptBuffer with 2 data segments where 2nd segment is empty (size 0, buffer null). The 2nd empty segment was likely added in WorkerScriptLoader::didFinishLoading by append(decoder->flush()) where flush can return an empty string. ScriptBufferSourceProvider will call makeContiguous on scriptBuffer which for the above case end up making an unnecessary copy and this memory is kept alive by ScriptBufferSourceProvider thus increasing memory usage. ScriptBuffer should not add an empty segment to the buffer when append is called with empty string.
Attachments
Radar WebKit Bug Importer
Comment 1 2023-11-23 11:59:14 PST
Mark Lam
Comment 2 2023-11-23 13:32:15 PST
EWS
Comment 3 2023-11-29 07:03:26 PST
Committed 271275@main (d445ae96c998): <https://commits.webkit.org/271275@main> Reviewed commits have been landed. Closing PR #20855 and removing active labels.
Note You need to log in before you can comment on or make changes to this bug.