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

Issue 762032 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Sep 2017
Cc:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Potential memory leak in memory_instrumentation

Project Member Reported by etienneb@chromium.org, Sep 5 2017

Issue description

A potential memory leak was detected by running a browser for a week and grabing a memory dump at the end.

The attached stack-frame is the source of the allocations.

A potential leak of 11M, for 11K objects.
 
bug.png
86.2 KB View Download
Cc: chrisha@chromium.org
I gave a quick look to the code and I believe the leak is caused by a map that is incorrectly handled.

The call to the memory instrumentation is done here:

  
  https://cs.chromium.org/chromium/src/services/resource_coordinator/memory_instrumentation/coordinator_impl.cc?type=cs&sq=package:chromium&l=303

    client->RequestOSMemoryDump(wants_mmaps, {base::kNullProcessId},
                                os_callback);

which is calling |os_callback| (CoordinatorImpl::OnOSMemoryDumpResponse) with the result.

The |OnOSMemoryDumpResponse| is booking information for processes.
  
  
  https://cs.chromium.org/chromium/src/services/resource_coordinator/memory_instrumentation/coordinator_impl.cc?type=cs&sq=package:chromium&l=399

    request->responses[client].os_dumps = std::move(os_dumps);


As I get it, these information are removed here:

  
  https://cs.chromium.org/chromium/src/services/resource_coordinator/memory_instrumentation/coordinator_impl.cc?type=cs&sq=package:chromium&l=422

    request->pending_responses.erase(it);


I suspect an incorrect tracking. But, I can't explain the conditions causing the leak.
Cc: primiano@chromium.org
+primiano
Cc: oysteine@chromium.org
oysteine, can you find an owner for this bug.
Cc: hjd@chromium.org
+ hjd

This code is owned by Primiano and Hector.
Do you know if this is increasing over time or not?
This looks suspiciously similar to crbug.com/750696#c15 (we just send over a *lot* of mmaps), although on Linux the order of magnitude was around 1MB, here we are 1 order off. Is there a number of objects potentially leaked in that report?
> order of magnitude was around 1MB, here we are 1 order off. 
Ah you wrote it in #0, 11k. Hmm, the number of objects is sort of compatible with "this is just one snapshot", but why the amount of memory is 10x?
Oups, the amount of memory 1.1M, not 11M.

Comment 8 by hjd@chromium.org, Sep 5 2017

I was going to link to the same bug as Primiano ;)

Which OS was this (and also was this a official or local build)?
Could you upload the trace file if you have it and if you still have the browser open there are some UMA which could help debugging. Thanks!
This was canary (last week) on a Mac.

Memory dump is attached.
mac_longrunning_trace.json.gz
5.8 MB Download
[etienneb clarified offline that the size is 1.1 MB not 11MB)

hjd and I discussed offline, given that there are 5 processes involved, and any of them seems to have (at least by looking at vmmap -v) at least 1k entries, the math seem to match: 5 (processes) x 1k (entries) at least 160 bytes per entry (min sizeof(VMRegion) without any string) -> 800K

in other words, I don't this is a leak, this is just the cost of shipping the mmaps for all processes for *one* snapshot :/
Status: WontFix (was: Untriaged)
Thanks for following up. :)

Sign in to add a comment