Fix WinHeap accounting for large allocations [chromium/src : main]

3 views
Skip to first unread message

José Dapena Paz (Gerrit)

unread,
May 6, 2026, 4:02:12 AMMay 6
to chromium...@chromium.org, spang...@chromium.org, wfh+...@chromium.org, tracing...@chromium.org

José Dapena Paz has uploaded the change for review

Commit message

Fix WinHeap accounting for large allocations

HeapWalk reports normal heap regions as PROCESS_HEAP_REGION entries, but
large allocations appear only as orphan busy entries outside any region.
Without tracking those, the WinHeap dump under-reports committed memory
in memory-infra traces.

Count busy entries that fall outside any region as committed memory.
Change-Id: Ia44527cf894ba0a2b4501bfa31e4e7cea69c6fc0

Change diff


Change information

Files:
  • M base/trace_event/malloc_dump_provider.cc
Change size: S
Delta: 1 file changed, 29 insertions(+), 2 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia44527cf894ba0a2b4501bfa31e4e7cea69c6fc0
Gerrit-Change-Number: 7816237
Gerrit-PatchSet: 1
Gerrit-Owner: José Dapena Paz <jda...@igalia.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

José Dapena Paz (Gerrit)

unread,
May 7, 2026, 5:02:53 AMMay 7
to Mikhail Khokhlov, Chromium LUCI CQ, chromium...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
Attention needed from Mikhail Khokhlov

José Dapena Paz added 1 comment

Patchset-level comments
File-level comment, Patchset 3 (Latest):
José Dapena Paz . resolved

This is the first in a series of changes to the memory accounting, that intends to improve and unify how the malloc/ section in memory infra captures is represented.

Open in Gerrit

Related details

Attention is currently required from:
  • Mikhail Khokhlov
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia44527cf894ba0a2b4501bfa31e4e7cea69c6fc0
Gerrit-Change-Number: 7816237
Gerrit-PatchSet: 3
Gerrit-Owner: José Dapena Paz <jda...@igalia.com>
Gerrit-Reviewer: José Dapena Paz <jda...@igalia.com>
Gerrit-Reviewer: Mikhail Khokhlov <khok...@google.com>
Gerrit-Attention: Mikhail Khokhlov <khok...@google.com>
Gerrit-Comment-Date: Thu, 07 May 2026 09:02:33 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Mikhail Khokhlov (Gerrit)

unread,
May 7, 2026, 6:22:44 AMMay 7
to José Dapena Paz, Siddhartha S, Chromium LUCI CQ, chromium...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
Attention needed from José Dapena Paz and Siddhartha S

Mikhail Khokhlov added 1 comment

Patchset-level comments
Mikhail Khokhlov . resolved

ssid@ PTAL, since this is memory-infra related.

Open in Gerrit

Related details

Attention is currently required from:
  • José Dapena Paz
  • Siddhartha S
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ia44527cf894ba0a2b4501bfa31e4e7cea69c6fc0
Gerrit-Change-Number: 7816237
Gerrit-PatchSet: 3
Gerrit-Owner: José Dapena Paz <jda...@igalia.com>
Gerrit-Reviewer: José Dapena Paz <jda...@igalia.com>
Gerrit-Reviewer: Siddhartha S <ss...@chromium.org>
Gerrit-CC: Mikhail Khokhlov <khok...@google.com>
Gerrit-Attention: José Dapena Paz <jda...@igalia.com>
Gerrit-Attention: Siddhartha S <ss...@chromium.org>
Gerrit-Comment-Date: Thu, 07 May 2026 10:22:27 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Siddhartha S (Gerrit)

unread,
May 8, 2026, 1:00:35 AM (14 days ago) May 8
to José Dapena Paz, Siddhartha S, Mikhail Khokhlov, Chromium LUCI CQ, chromium...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
Attention needed from José Dapena Paz

Siddhartha S added 2 comments

File base/trace_event/malloc_dump_provider.cc
Line 76, Patchset 3 (Latest):void WinHeapMemoryDumpImpl(WinHeapInfo* crt_heap_info) {
Siddhartha S . unresolved

can we test this in unittests. can they call HeapWalk? can we add some sanity checks for range of numbers we should see..

Line 94, Patchset 3 (Latest): if (entry_addr < last_region_start || entry_addr >= last_region_end) {
Siddhartha S . unresolved

this code depends on the ordering guarantees of the HeapWalk, maybe add a comment to the documentation that provides this guarantee

Open in Gerrit

Related details

Attention is currently required from:
  • José Dapena Paz
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ia44527cf894ba0a2b4501bfa31e4e7cea69c6fc0
    Gerrit-Change-Number: 7816237
    Gerrit-PatchSet: 3
    Gerrit-Owner: José Dapena Paz <jda...@igalia.com>
    Gerrit-Reviewer: José Dapena Paz <jda...@igalia.com>
    Gerrit-Reviewer: Siddhartha S <ss...@chromium.org>
    Gerrit-CC: Mikhail Khokhlov <khok...@google.com>
    Gerrit-Attention: José Dapena Paz <jda...@igalia.com>
    Gerrit-Comment-Date: Fri, 08 May 2026 05:00:25 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Will Harris (Gerrit)

    unread,
    May 8, 2026, 1:03:52 AM (14 days ago) May 8
    to José Dapena Paz, Will Harris, Siddhartha S, Mikhail Khokhlov, Chromium LUCI CQ, chromium...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
    Attention needed from José Dapena Paz

    Will Harris added 1 comment

    Patchset-level comments
    José Dapena Paz . unresolved

    This is the first in a series of changes to the memory accounting, that intends to improve and unify how the malloc/ section in memory infra captures is represented.

    Will Harris

    If this is a series of CLs can you create a task in the issue tracker representing the goal and the approach so the CLs can be tagged to the bug. Thanks.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • José Dapena Paz
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: Ia44527cf894ba0a2b4501bfa31e4e7cea69c6fc0
    Gerrit-Change-Number: 7816237
    Gerrit-PatchSet: 3
    Gerrit-Owner: José Dapena Paz <jda...@igalia.com>
    Gerrit-Reviewer: José Dapena Paz <jda...@igalia.com>
    Gerrit-Reviewer: Siddhartha S <ss...@chromium.org>
    Gerrit-CC: Mikhail Khokhlov <khok...@google.com>
    Gerrit-CC: Will Harris <w...@chromium.org>
    Gerrit-Attention: José Dapena Paz <jda...@igalia.com>
    Gerrit-Comment-Date: Fri, 08 May 2026 05:03:35 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: José Dapena Paz <jda...@igalia.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    José Dapena Paz (Gerrit)

    unread,
    May 18, 2026, 2:16:36 PM (3 days ago) May 18
    to Will Harris, Siddhartha S, Mikhail Khokhlov, Chromium LUCI CQ, chromium...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
    Attention needed from Siddhartha S and Will Harris

    José Dapena Paz added 3 comments

    Patchset-level comments
    José Dapena Paz . resolved

    This is the first in a series of changes to the memory accounting, that intends to improve and unify how the malloc/ section in memory infra captures is represented.

    Will Harris

    If this is a series of CLs can you create a task in the issue tracker representing the goal and the approach so the CLs can be tagged to the bug. Thanks.

    José Dapena Paz

    I created independent tickets for each bug, and each of the functional changes, as all were surfaced when trying to improve the malloc reported information in Linux and Windows, but there is not strict relation among them.

    Bugs:

    Then the features:

    File base/trace_event/malloc_dump_provider.cc
    Line 76, Patchset 3:void WinHeapMemoryDumpImpl(WinHeapInfo* crt_heap_info) {
    Siddhartha S . resolved

    can we test this in unittests. can they call HeapWalk? can we add some sanity checks for range of numbers we should see..

    José Dapena Paz

    Adding unit tests (with a small refactoring to be able to call the win heap dump from the test).

    Line 94, Patchset 3: if (entry_addr < last_region_start || entry_addr >= last_region_end) {
    Siddhartha S . resolved

    this code depends on the ordering guarantees of the HeapWalk, maybe add a comment to the documentation that provides this guarantee

    José Dapena Paz

    I will add a comment referring to the SDK document explaining this.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Siddhartha S
    • Will Harris
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Ia44527cf894ba0a2b4501bfa31e4e7cea69c6fc0
      Gerrit-Change-Number: 7816237
      Gerrit-PatchSet: 4
      Gerrit-Owner: José Dapena Paz <jda...@igalia.com>
      Gerrit-Reviewer: José Dapena Paz <jda...@igalia.com>
      Gerrit-Reviewer: Siddhartha S <ss...@chromium.org>
      Gerrit-CC: Mikhail Khokhlov <khok...@google.com>
      Gerrit-CC: Will Harris <w...@chromium.org>
      Gerrit-Attention: Will Harris <w...@chromium.org>
      Gerrit-Attention: Siddhartha S <ss...@chromium.org>
      Gerrit-Comment-Date: Mon, 18 May 2026 18:16:21 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: José Dapena Paz <jda...@igalia.com>
      Comment-In-Reply-To: Will Harris <w...@chromium.org>
      Comment-In-Reply-To: Siddhartha S <ss...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Will Harris (Gerrit)

      unread,
      May 18, 2026, 3:47:56 PM (3 days ago) May 18
      to José Dapena Paz, Will Harris, Siddhartha S, Mikhail Khokhlov, Chromium LUCI CQ, chromium...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
      Attention needed from José Dapena Paz and Siddhartha S

      Will Harris added 4 comments

      Patchset-level comments
      File-level comment, Patchset 4 (Latest):
      Will Harris . unresolved

      this is cool I did not know about this behavior of heap where the values were optional. this seems like a very reasonable approach to fix this issue. thank you!

      what are these data used for - is this going to change metrics in any way?

      File base/trace_event/malloc_dump_provider.h
      Line 174, Patchset 4 (Latest):BASE_EXPORT void WinHeapMemoryDumpImpl(void* heap, WinHeapInfo* info);
      Will Harris . unresolved

      `info` is a non-optional out param, so please use a ref here.

      File base/trace_event/malloc_dump_provider.cc
      Line 78, Patchset 4 (Latest): reinterpret_cast<HANDLE>(_get_heap_handle()), &main_heap_info);
      Will Harris . unresolved

      this is passing a HANDLE and yet the function takes a void* - can you fix?

      Line 315, Patchset 4 (Latest): info->committed_size += heap_entry.cbData + heap_entry.cbOverhead;
      Will Harris . unresolved

      cbData is DWORD 32-bit - should this be promoted to a `size_t` before the addition, so very large `cbData` sizes near the 32-bit boundary can't overflow?

      e.g.

      `static_cast<size_t>(heap_entry.cbData)`

      Open in Gerrit

      Related details

      Attention is currently required from:
      • José Dapena Paz
      • Siddhartha S
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Ia44527cf894ba0a2b4501bfa31e4e7cea69c6fc0
        Gerrit-Change-Number: 7816237
        Gerrit-PatchSet: 4
        Gerrit-Owner: José Dapena Paz <jda...@igalia.com>
        Gerrit-Reviewer: José Dapena Paz <jda...@igalia.com>
        Gerrit-Reviewer: Siddhartha S <ss...@chromium.org>
        Gerrit-CC: Mikhail Khokhlov <khok...@google.com>
        Gerrit-CC: Will Harris <w...@chromium.org>
        Gerrit-Attention: José Dapena Paz <jda...@igalia.com>
        Gerrit-Attention: Siddhartha S <ss...@chromium.org>
        Gerrit-Comment-Date: Mon, 18 May 2026 19:47:48 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Siddhartha S (Gerrit)

        unread,
        May 19, 2026, 10:29:23 AM (2 days ago) May 19
        to José Dapena Paz, Will Harris, Siddhartha S, Mikhail Khokhlov, Chromium LUCI CQ, chromium...@chromium.org, spang...@chromium.org, tracing...@chromium.org, wfh+...@chromium.org
        Attention needed from José Dapena Paz

        Siddhartha S added 2 comments

        Patchset-level comments
        Siddhartha S . resolved

        Moving Will to reviewer.

        Will Harris . unresolved

        this is cool I did not know about this behavior of heap where the values were optional. this seems like a very reasonable approach to fix this issue. thank you!

        what are these data used for - is this going to change metrics in any way?

        Siddhartha S

        I believe the MemoryDumpLevelOfDetail::kDetailed should only be triggered on local tracing. so, this change should not impact chrome metrics, including any malloc related uma counters.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • José Dapena Paz
        Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement is not satisfiedCode-Review
        • requirement is not satisfiedNo-Unresolved-Comments
        • requirement is not satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: Ia44527cf894ba0a2b4501bfa31e4e7cea69c6fc0
        Gerrit-Change-Number: 7816237
        Gerrit-PatchSet: 4
        Gerrit-Owner: José Dapena Paz <jda...@igalia.com>
        Gerrit-Reviewer: José Dapena Paz <jda...@igalia.com>
        Gerrit-Reviewer: Siddhartha S <ss...@chromium.org>
        Gerrit-CC: Mikhail Khokhlov <khok...@google.com>
        Gerrit-CC: Will Harris <w...@chromium.org>
        Gerrit-Attention: José Dapena Paz <jda...@igalia.com>
        Gerrit-Comment-Date: Tue, 19 May 2026 14:29:13 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Will Harris <w...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy
        Reply all
        Reply to author
        Forward
        0 new messages