Background context:go/memory-infra: memory profiling in chrome://tracing
The mtv team and tokyo team in trim are trying to analyze the peak memory usage of Chrome to avoid OOMs.
To help this investigations MemoryInfra should support a mode which collects memory dumps automatically.
Some ideas:
1. Find a good point in code for high frequency memory-polling. It could possibly be MessageLoop::RunTask. I can see that this could be part of the HEAP_PROFILER_API_SCOPED_TASK_EXECUTION_EVENT, which already covers all the tasks. Poll for memory usage if tracing is enabled with memory-infra category.
2. If the memory - (pss / private dirty) increased from previous poll to this poll by 15%? then trigger a memory dump (RequestGlobalMemoryDump). This could also be changed as increase over 2 seconds is 15%.
3. Now the increase could be because of memory-infra overhead that the memory usage increased. How do we discount overhead in a quick way. Do we need to worry about overhead at all here?
Also Make sure we do not trigger dumps too frequently.
I think this mode should be enabled by default if we can fix the issues given at (3). If not, we should introduce a new entry in trace config memory dump triggers:
'memory_gain' : {'15%', 'detailed'}
'memory_gain' : {'5%', 'light'}.
Comment 1 by ssid@chromium.org
, Jul 21 2016