Bug 217078 - Form with Input causes memory leak
Summary: Form with Input causes memory leak
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Safari 14
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-09-28 21:49 PDT by Clark Pan
Modified: 2020-10-26 19:33 PDT (History)
6 users (show)

See Also:


Attachments
Test file to reproduce form and input element leak (1.14 KB, text/html)
2020-09-28 21:49 PDT, Clark Pan
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Clark Pan 2020-09-28 21:49:58 PDT
Created attachment 409963 [details]
Test file to reproduce form and input element leak

When a form with an input inside of it is detached and dereferenced, the memory associated with the form is not GC'ed

Steps to reproduce:

- Open provided example file in Safari (Desktop). (tested in Version 14.0 (15610.1.28.1.9, 15610), no extensions)
- Open up Web Inspector -> Timelines -> Javascript Allocations.
- Take a snapshot.
- Click 'Click to add form' button a few times (mounts and unmounts a form and an input).
- Take a snapshot.
- Compare snapshots.

Expected
- No leaked memory

Actual
- The HTMLFormElement and HTMLInputElements are leaked.

Notes:
- Does not happen on iOS Safari with same webkit versions.
- If its a stand alone <input> without a wrapping <form>, the same behaviour does not occur.
- If there is no <input> inside the <form>, the HTMLFormElement is not leaked.
- Looking at the path to root object within the snapshot inspector for the HTMLFormElement shows either:
a) "This object is a root"
b) A retaining path from an object via a property called "_controlUniqueIDToControlMap"
Comment 1 Alexey Proskuryakov 2020-09-29 09:23:27 PDT
Thank you for the report, and for the detailed analysis.

This looks like an issue in Safari forms autofill code, not in WebKit. Keeping this open because I'm not entirely certain, but also importing to Apple internal system for investigation.
Comment 2 Radar WebKit Bug Importer 2020-09-29 09:23:38 PDT
<rdar://problem/69750302>
Comment 3 Clark Pan 2020-10-26 16:05:07 PDT
Thanks for cross reporting to the Apple internal system Alexey.

Is there a way to get some transparency on the progress of the ticket? Does the internal system auto report progress back out to the public system?
Comment 4 Alexey Proskuryakov 2020-10-26 16:14:25 PDT
I think that the best way would be for you to file your own report via feedbackassistant.apple.com, and then we could dupe mine to it. This way, you will have all standard communication via feedback assistant.

Please post the report number here is you choose to go this path (it will start with FB).

Marking INVALID, as I think we confirmed this to be a Safari issue.
Comment 5 Clark Pan 2020-10-26 19:33:02 PDT
Done: FB8828701