New issue
Advanced search Search tips

Issue 918940 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Bug

Blocked on:
issue 923023



Sign in to add a comment

Implement MemoryDumpProvider(s) for code cache in renderers

Project Member Reported by pasko@chromium.org, Jan 3

Issue description

Just out of curiosity: how much memory does code cache consume in the field? If it is >1 MiB often ehough, we can think of helping it be more sensitive to low memory notifications. Maybe.

My brief look reveals that some code cache is attached to resources, like: blink::Resource -> cache_handler_ -> blink::CachedMetadata. Seems that a MemoryDumpProvider for those CacheMetadata attached to memory UMA (potentially easily UKM-able) would be a good approach.

mythria/rmcilroy: WDYT? Are there more copies to take care of? Does code cache get copied to v8 heap?
 
V8.CodeCacheSizeRatio shows that the ratio of cache size to code size is usually 100x. It seems to be recorded every time we add anything to cache. Unsure what the size of source here is. The actual allocations are made from Blink GC heap.
Yes, Resource->cache_handler_ is the one that stores the code cache in memory. 
V8 also stores the deserialized code caches in its compilation caches in memory [1]. The compilation caches cache any code that was generated/deserialized. The deserialized code is on the V8 heap. It doesn't maintain the serialized version though.

I am not sure about how much memory is consumed by code cache though, but I was curious too. I was wondering if we should even store it in memory on blink side since V8 already stores the deserialized code cache in its compilation cache. I was interested in seeing how often we have served the code cache from memory (not fetching from the disk) when there was no entry in the compilation cache. 

The V8.CodeCacheSizeRatio is the ratio of serialized code to the size of the script [2]. That gives a nice approximation of the size of cache we are producing but may be a bit difficult to estimate how much of this we are holding in memory. This is also not a right measure for the size of serialized vs deserialized code cache size since most of the script is not compiled.

[1] https://cs.chromium.org/chromium/src/v8/src/compilation-cache.h?gsn=compilation_cache_&g=0&l=153
[2] https://cs.chromium.org/chromium/src/third_party/blink/renderer/bindings/core/v8/v8_code_cache.cc?q=V8.CodeCacheSizeRatio&sq=package:chromium&g=0&l=208


Cc: yangguo@chromium.org hirosh...@chromium.org leszeks@chromium.org

Comment 4 by pasko@chromium.org, Yesterday (41 hours ago)

Blockedon: 923023

Sign in to add a comment