New issue
Advanced search Search tips

Issue 769617 link

Starred by 1 user

Issue metadata

Status: Started
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug

Blocking:
issue 824834
issue 864469
issue 864503
issue 865640
issue 866504


Show other hotlists

Hotlists containing this issue:
Autofill-Fixit


Sign in to add a comment

[Autofill] Discard unused FormStructure in AutofillManager (avoid possible high memory usage)

Project Member Reported by erikc...@chromium.org, Sep 28 2017

Issue description

The desktop memory team is profiling the browser process by recording all allocations, and tracking live allocations. Reports are automatically uploaded when memory usage crosses a threshold.

In this case, we received a report of a browser process that was using 310MB of malloc on macOS. go/crash/ffd15e77c368dde7.

I've attached a json file that shows all the major allocations in the browser process. To view the json file, copy its contents to http://jsonviewer.stack.hu/. 

The three stacks I've attached as screenshots are responsible for ~50k live objects in the browser process, that account for 10MB of memory. This seems like an exceptional amount for Autofill to use, and may indicate the presence of a live leak [memory that is still reachable, but is unused].

Glancing through AutofillManager::ParseForm, it looks like form_structures_ will continually grow until Reset() is called, which happens on main frame navigation. But this means that if a user has a long-running page that generates/destroy many forms...then this list will potentially grow indefinitely?

Please help us better understand what's going on here. Note that ~85% of the bugs we've filed with this tool have resulted in the discovery of real issues, so please don't just dismiss this out of hand. :)

+ autofill OWNERs
+ ssid: Does this code affect Android?
 
Screen Shot 2017-09-28 at 3.48.47 PM.png
196 KB View Download
Screen Shot 2017-09-28 at 3.49.00 PM.png
189 KB View Download
Screen Shot 2017-09-28 at 3.49.08 PM.png
193 KB View Download
trace-ffd15e77c368dde7.gz
287 KB Download

Comment 1 by ma...@chromium.org, Sep 28 2017

Components: UI>Browser>Autofill
Labels: -Pri-3 Pri-2
Owner: rogerm@chromium.org
Status: Assigned (was: Untriaged)
Summary: [Autofill] Discard unused FormStructure in AutofillManager (avoid possible high memory usage) (was: Autofill uses 10MB in browser process.)
I could see a scenario where accumulating in |form_structures_| would happen (a page dynamically changing forms, for a while). We should improve our management of |form_structures_|. 

A refactor was already planned, but it seems like we should probably accelerate those plans. Assigning to rogerm@ for him or someone else to take it on.

Comment 2 by se...@chromium.org, Jan 16 2018

Owner: se...@chromium.org
Status: Started (was: Assigned)

Comment 3 by ma...@chromium.org, May 1 2018

Status: Untriaged (was: Started)

Comment 4 by se...@chromium.org, May 15 2018

Status: Started (was: Untriaged)
Owner: rogerm@chromium.org
Blocking: 824834
Project Member

Comment 7 by bugdroid1@chromium.org, Aug 18

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/008b3ce56694851ea6d0a6bcdbe961d878cd8b99

commit 008b3ce56694851ea6d0a6bcdbe961d878cd8b99
Author: Roger McFarlane <rogerm@chromium.org>
Date: Sat Aug 18 09:59:36 2018

[autofill] Refactor form structure cache from vector to map.

The current implementation uses a vector to store all the forms that we
parse. The code to find cached forms the searches that vector starting
from the back.

This CL changes the cache to a map instead, so each form will be saved
only once. The key is the FormSignature and the value is a unique ptr
to the FormStructure.

Notable differences

- AutofillHandler now holds a map, by form signature, of FormStructure
  unique_ptrs instead of a vector.

- Parsing/updating FormData associated with a given signature now
  delete any previously cached FormStructure for that signature.

- form_structure_browsertests sorts currently known form structures
  by their earliest parse time, to preserve the output ordering.

- AutofillHandler::FindCachedForm
  To update an existing form signature, this function is O(lg n).
  when inserting a new form signaure this function is O(n + log n).

Bug: 769617, 864469, 864503, 865640, 866504
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I630336d6672a57acbe0257501c44f540b39341de
Reviewed-on: https://chromium-review.googlesource.com/1175456
Commit-Queue: Roger McFarlane <rogerm@chromium.org>
Reviewed-by: Moe Ahmadi <mahmadi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584311}
[modify] https://crrev.com/008b3ce56694851ea6d0a6bcdbe961d878cd8b99/chrome/browser/autofill/form_structure_browsertest.cc
[modify] https://crrev.com/008b3ce56694851ea6d0a6bcdbe961d878cd8b99/components/autofill/core/browser/autofill_assistant.cc
[modify] https://crrev.com/008b3ce56694851ea6d0a6bcdbe961d878cd8b99/components/autofill/core/browser/autofill_assistant.h
[modify] https://crrev.com/008b3ce56694851ea6d0a6bcdbe961d878cd8b99/components/autofill/core/browser/autofill_assistant_unittest.cc
[modify] https://crrev.com/008b3ce56694851ea6d0a6bcdbe961d878cd8b99/components/autofill/core/browser/autofill_handler.cc
[modify] https://crrev.com/008b3ce56694851ea6d0a6bcdbe961d878cd8b99/components/autofill/core/browser/autofill_handler.h
[modify] https://crrev.com/008b3ce56694851ea6d0a6bcdbe961d878cd8b99/components/autofill/core/browser/autofill_manager.cc
[modify] https://crrev.com/008b3ce56694851ea6d0a6bcdbe961d878cd8b99/components/autofill/core/browser/autofill_manager.h
[modify] https://crrev.com/008b3ce56694851ea6d0a6bcdbe961d878cd8b99/components/autofill/core/browser/autofill_manager_unittest.cc
[modify] https://crrev.com/008b3ce56694851ea6d0a6bcdbe961d878cd8b99/components/autofill/core/browser/autofill_metrics_unittest.cc
[modify] https://crrev.com/008b3ce56694851ea6d0a6bcdbe961d878cd8b99/components/autofill/core/browser/autofill_test_utils.cc
[modify] https://crrev.com/008b3ce56694851ea6d0a6bcdbe961d878cd8b99/components/autofill/core/browser/autofill_test_utils.h
[modify] https://crrev.com/008b3ce56694851ea6d0a6bcdbe961d878cd8b99/components/autofill/core/browser/credit_card_save_manager_unittest.cc
[modify] https://crrev.com/008b3ce56694851ea6d0a6bcdbe961d878cd8b99/components/autofill/core/browser/form_structure.cc
[modify] https://crrev.com/008b3ce56694851ea6d0a6bcdbe961d878cd8b99/components/autofill/core/browser/form_structure.h
[modify] https://crrev.com/008b3ce56694851ea6d0a6bcdbe961d878cd8b99/components/autofill/core/browser/test_autofill_manager.cc
[modify] https://crrev.com/008b3ce56694851ea6d0a6bcdbe961d878cd8b99/ios/chrome/browser/autofill/autofill_controller_unittest.mm
[modify] https://crrev.com/008b3ce56694851ea6d0a6bcdbe961d878cd8b99/ios/chrome/browser/autofill/form_structure_browsertest.mm

Cc: -vabr@chromium.org
vabr going hobby only -> reducing involvement.
Please contact me directly in urgent matters.

Sign in to add a comment