• Joakim Bengtsson's avatar
    Improve V8 GC logic for external memory · 4b1447e4
    Joakim Bengtsson authored
    The logic for V8 GC normally only takes the external memory growth
    since last mark-compact into account. Unfortunately, the amount of
    external memory recorded at the end of MC is often too high. The
    reason is that it might take a while for the external memory
    associated with the GCed objects to be released (e.g. V8 itself post a
    task to release external memory for ArrayBuffer backing stores). In a
    worst case scenario GC is driven only by external memory and none of
    the external memory is released by the end of the MC. Then each MC
    will record the external memory at its highest point and the GC logic
    will allow the external memory to grow a bit higher each time which
    can lead to excessive memory use.
    
    This patch improves the situation a bit by calculating the growth from
    the lowest external memory seen since the last MC. That way the growth
    calculation will be offset from a level presumably closer to the
    intended one (to what it would have been if the external memory
    associated with the GCed objects was released during the MC). Now,
    this fix is not perfect because it can be thrown off by external
    memory growth occurring before the lingering memory is
    released. However, it seems to work rather well in practice (e.g. when
    playing MSE video on YT).
    
    Bug: v8:10185
    Change-Id: Ifcdd87eb45f3ae4a99d2aeec667c3ae4ca9a52b6
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2042711Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
    Reviewed-by: 's avatarDominik Inführ <dinfuehr@chromium.org>
    Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
    Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#66193}
    4b1447e4
Name
Last commit
Last update
build_overrides Loading commit data...
custom_deps Loading commit data...
docs Loading commit data...
gni Loading commit data...
include Loading commit data...
infra Loading commit data...
samples Loading commit data...
src Loading commit data...
test Loading commit data...
testing Loading commit data...
third_party Loading commit data...
tools Loading commit data...
.clang-format Loading commit data...
.clang-tidy Loading commit data...
.editorconfig Loading commit data...
.flake8 Loading commit data...
.git-blame-ignore-revs Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.gn Loading commit data...
.vpython Loading commit data...
.ycm_extra_conf.py Loading commit data...
AUTHORS Loading commit data...
BUILD.gn Loading commit data...
CODE_OF_CONDUCT.md Loading commit data...
COMMON_OWNERS Loading commit data...
DEPS Loading commit data...
ENG_REVIEW_OWNERS Loading commit data...
INFRA_OWNERS Loading commit data...
INTL_OWNERS Loading commit data...
LICENSE Loading commit data...
LICENSE.fdlibm Loading commit data...
LICENSE.strongtalk Loading commit data...
LICENSE.v8 Loading commit data...
LICENSE.valgrind Loading commit data...
MIPS_OWNERS Loading commit data...
OWNERS Loading commit data...
PPC_OWNERS Loading commit data...
PRESUBMIT.py Loading commit data...
README.md Loading commit data...
S390_OWNERS Loading commit data...
WATCHLISTS Loading commit data...
codereview.settings Loading commit data...