| Summary: | Misleading Web Inspector Page Memory reading when using FileReader.readAsArrayBuffer() | ||||||
|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Dmitry Sharygin <dmitry.sharygin> | ||||
| Component: | Web Inspector | Assignee: | Nobody <webkit-unassigned> | ||||
| Status: | NEW --- | ||||||
| Severity: | Major | CC: | inspector-bugzilla-changes, pangle, webkit-bug-importer | ||||
| Priority: | P2 | Keywords: | InRadar | ||||
| Version: | Safari 15 | ||||||
| Hardware: | iPhone / iPad | ||||||
| OS: | iOS 15 | ||||||
| Attachments: |
|
||||||
|
Description
Dmitry Sharygin
2022-06-18 07:03:19 PDT
Webkit Inspector was misleading/indicating a red herring problem in that it was showing page memory increase, but only while the Inspector tool was open and recording the timeline. I did another experiment where I used the file picker to open files many times in a row and only then started recording the timeline in the Inspector - it showed memory to not be elevated. The actual issue in our app turned out to be caused by code not cleaning up the FileReader event handlers. There were several places where a FileReader was used without cleanup, including an external image resizing library. There are two area for improvement that I see: 1. Online docs (such as MDN) should be updated to reflect correct FileReader usage - seems like most npm packages out there are not cleaning up the event handlers, which can cause memory leaks over time in long-running applications. 2. Webkit Inspector can be improved by correctly showing the page memory allocation, so that people don't chase after red herrings. Can the Webkit team please investigate the latter? Thank you for getting to the root cause of this issue! |