New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 741849 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner:
Last visit > 30 days ago
Closed: Sep 10
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 741029



Sign in to add a comment

1KB data url SVG allocates ~17KB in core/html/parser

Project Member Reported by pdr@chromium.org, Jul 12 2017

Issue description

Investigating the memory of SVG images I found that a 1KB data url SVG image allocates ~17KB in core/html/parser.

My testcase is here with 1000 unique 1KB SVG data uri images: https://output.jsbin.com/bijoyaf/quiet

Using --enable-heap-profiling and about:tracing with memory-infra enabled, I found this page allocates 20.8MB (malloc) of which the parser is 17.0MB. I found this malloc does not occur if the svg data is all inlined on an html page.

Kouhei, would you be able to look into this? This is important for low-memory android devices.
 

Comment 1 by pdr@chromium.org, Jul 12 2017

Description: Show this description

Comment 2 by kouhei@chromium.org, Jul 12 2017

Interesting find! I'll take a brief look today or tomorrow to get a rough estimate on what we can do.
Description: Show this description
@pdr: do you mean that when inlining the SVG it avoids all 17MB?

Comment 5 by pdr@chromium.org, Jul 12 2017

Inlining the SVG drops the allocations to near zero. Possibly SVGImage is leaving around HTMLParser data?

Comment 6 by pdr@chromium.org, Jul 12 2017

Description: Show this description

Comment 7 by kouhei@chromium.org, Jul 13 2017

Components: -Blink>HTML>Parser Blink>XML
This path is actually triggering XML parser not HTML parser. I'll follow up details shortly.

Comment 9 by pdr@chromium.org, Jul 17 2017

Were you able to make any more progress on this?
No. I'm keeping the doc up to date.

Yesterday was a public holiday in Japan and code search seems still missing Xrefs.
I plan to work on this until I have a good explanation of the stack trace graph (esp for ProxyResolverFactory).

I'd appreciate your help if you want to move this faster. For example, I think we can distribute work figuring out mallocs involved in "creating a frame" and "libxml parsing svg XML".
Status: Started (was: Assigned)
tasak@ is currently investigating the unknown 9MB. Please see the doc for details

Comment 12 by tasak@google.com, Jul 24 2017

Cc: kouhei@chromium.org
Owner: tasak@google.com

Comment 13 by tasak@google.com, Jul 24 2017

I've just finished investigating "9300KiB not captured by the allocator shim" in the document.

The most of the allocation is required by tracing. 

e.g. tcmalloc's PageHeap::stats_.unmapped_bytes += 13,950,976 at stacktrace:

ShimRealloc at base/allocator/allocator_shim.cc:218 (inlined by) __libc_realloc at base/allocator/allocator_shim_override_glibc_weak_symbols.h:86
Resize at base/pickle.cc:381
ClaimUninitializedBytesInternal at base/pickle.cc:463 (inlined by) WriteBytesCommon at base/pickle.cc:477 (inlined by) WriteBytes at base/pickle.cc:349
WriteKeyNameAsRawPtr at base/trace_event/trace_event_argument.cc:49 (inlined by) BeginArray at base/trace_event/trace_event_argument.cc:183

c.f.
https://docs.google.com/a/google.com/spreadsheets/d/1Z4xu8X2jGFYq9phxPahse3wZKmd0zuHuqge5h6vVE6U/edit?usp=sharing
(This spreadsheet was created by dumping data when changing unmapped_size of PageHeap::stats_. The data is [function_name, delta of unmapped_size, unmapped_size, thread_id, stacktrace].)

So malloc usage will be reduced after finishing tracing.

Withouot this tracing overhead, how much overhead still remains?

Comment 15 by tasak@google.com, Mar 19 2018

Labels: -Pri-1 Pri-3
Status: Assigned (was: Started)
I obtained trace.json again.
I think, without this tracing overhead, "tracing" column says remaining tracing overhead. i.e. 0.6MiB (renderer)

This issue will be fixed by new native sampling profiler. c.f.  crbug.com/803276 
trace.json.gz
2.0 MB Download
Owner: tasak@chromium.org
Status: WontFix (was: Assigned)
Closing WontFix based on comment #19.

Sign in to add a comment