RESOLVED CONFIGURATION CHANGED 203991
Safari leaks memory of Cache/Response objects of CacheStorage API
https://bugs.webkit.org/show_bug.cgi?id=203991
Summary Safari leaks memory of Cache/Response objects of CacheStorage API
Konstantin Kaefer
Reported 2019-11-07 22:43:49 PST
Created attachment 383113 [details] Memory leak with CacheStorage/Cache/Response When using the CacheStorage API and calling `cache.keys()` to retrieve all items stored in a cache, Safari won't free the memory of those objects. The attached sample page opens the Cache repeatedly, and requests keys. Memory grows to several gigabytes in the span of a few seconds.
Attachments
Memory leak with CacheStorage/Cache/Response (712 bytes, text/html)
2019-11-07 22:43 PST, Konstantin Kaefer
no flags
Radar WebKit Bug Importer
Comment 1 2020-01-08 12:16:38 PST
youenn fablet
Comment 2 2020-01-09 06:46:44 PST
Doing a quick test, the script creates lots of objects that at some point gets collected. I do not see a leak per se although we should probably try to improve memory management, in particular not send response body until actually requested by the page. Konstantin, can you validate that memory consumption does not increase forever on your setup as well?
Konstantin Kaefer
Comment 3 2020-01-09 06:51:41 PST
Thanks for looking into this issue. It looks like it's growing linearly until ~3GB on my machine, then some objects are garbage collected. It seems like the garbage collector isn't aware of the true size of these objects, so it doesn't collect them even though they take up a lot of memory.
youenn fablet
Comment 4 2020-03-24 02:07:52 PDT
I removed buffering of request/response in https://bugs.webkit.org/show_bug.cgi?id=209425. That should help this.
Note You need to log in before you can comment on or make changes to this bug.