Skip to content

deps: V8: cherry-pick 92ac9425fa52 - #66527

Open
IlyasShabi wants to merge 1 commit into
nodejs:mainfrom
IlyasShabi:ishabi/v8-backport-adjustable-heap-sampling
Open

IlyasShabi wants to merge 1 commit into
nodejs:mainfrom
IlyasShabi:ishabi/v8-backport-adjustable-heap-sampling

Conversation

@IlyasShabi

Copy link
Copy Markdown
Member

Original commit message:

[profiler] Adjustable heap profiler sampling interval

This change makes the V8 sampling heap profiler interval adjustable
while heap sampling is running. Today, the sampling interval is fixed
for the whole profiling session. Developers who want to adapt sampling
under high allocation load have to stop the profiler and start it again
with a new interval, which loses continuity.

This PR adds a small API surface for adaptive heap sampling:

- SetSamplingHeapProfilerInterval(sample_interval) updates the active sampling interval.
- GetSamplingHeapProfilerSamples() returns the current retained samples without materializing the full allocation profile tree.
- AllocationProfile::Sample now includes sample_interval, so consumers know which interval was used when the sample was generated.

The new sample getter is intended for lightweight polling. It avoids the
extra work done by GetAllocationProfile(), such as translating the
allocation tree and resolving script metadata, when callers only need
sample information.

This keeps the adaptive policy outside V8: embedders can decide how to
adjust the interval, while V8 exposes the mechanism needed to do it.

Change-Id: I7cff46a13c02617d04149c8d5c273a8d9ef4bb9f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8130742
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#109934}

Refs: v8/v8@92ac942

Original commit message:

    [profiler] Adjustable heap profiler sampling interval

    This change makes the V8 sampling heap profiler interval adjustable
    while heap sampling is running. Today, the sampling interval is fixed
    for the whole profiling session. Developers who want to adapt sampling
    under high allocation load have to stop the profiler and start it again
    with a new interval, which loses continuity.

    This PR adds a small API surface for adaptive heap sampling:

    - SetSamplingHeapProfilerInterval(sample_interval) updates the active sampling interval.
    - GetSamplingHeapProfilerSamples() returns the current retained samples without materializing the full allocation profile tree.
    - AllocationProfile::Sample now includes sample_interval, so consumers know which interval was used when the sample was generated.

    The new sample getter is intended for lightweight polling. It avoids the
    extra work done by GetAllocationProfile(), such as translating the
    allocation tree and resolving script metadata, when callers only need
    sample information.

    This keeps the adaptive policy outside V8: embedders can decide how to
    adjust the interval, while V8 exposes the mechanism needed to do it.

    Change-Id: I7cff46a13c02617d04149c8d5c273a8d9ef4bb9f
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/8130742
    Reviewed-by: Camillo Bruni <cbruni@chromium.org>
    Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
    Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#109934}

Refs: v8/v8@92ac942
Signed-off-by: ishabi <ilyasshabi94@gmail.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/gyp
  • @nodejs/security-wg
  • @nodejs/v8-update

@IlyasShabi IlyasShabi added the semver-major PRs that contain breaking changes and should be released in the next major version. label Oct 5, 2026
@nodejs-github-bot nodejs-github-bot added build Issues and PRs related to Node.js builds or CI infrastructure. needs-ci PRs that need a full CI run. v8 engine Issues and PRs related to the V8 dependency. labels Oct 5, 2026
@Renegade334

Copy link
Copy Markdown
Member

From my understanding a V8 15.5 PR is planned for the main branch/v27.x, so I don't think there'll be any benefit to landing this separately?

@aduh95

aduh95 commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

From my understanding a V8 15.5 PR is planned for the main branch/v27.x, so I don't think there'll be any benefit to landing this separately?

Optimistic POV: yeah you're right
Pessimistic POV: if 15.5 fails to land on time for whatever reason, having this PR landed ensures the change makes it on time – it also allows it to be tested on Alpha releases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build Issues and PRs related to Node.js builds or CI infrastructure. needs-ci PRs that need a full CI run. semver-major PRs that contain breaking changes and should be released in the next major version. v8 engine Issues and PRs related to the V8 dependency.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants