Skip to content

!eeheap is reporting slightly inaccurate committed bytes. #3482

Closed

Description

@cshung

There are 2 cases where we are reporting slightly wrong numbers for committed bytes in !eeheap. The main problem is that, in general, the number of committed bytes is not exactly heap_segment_committed - heap_segment_mem. We typically have some space before heap_segment_mem to store something.

Case 1: Normal (i.e. not frozen) segments

  • For regions, the code is doing the right thing using regions_committed_adjustment, which should be sizeof(aligned_plug_and_gap).
  • For segments, this is currently wrong. The adjustment should be segment_info_size as in make_heap_segment. Depending on whether or not background GC is enabled, you could have either OS_PAGE_SIZE (which is OS-dependent) or align(sizeof(heap_segment)).

Case 2: Frozen segments.

The difference should be pseginfo->ibFirstObject as in GCHeap::RegisterFrozenSegment. In the frozen object heap implementation, we specified that as sizeof(ObjHeader).

The inaccuracies are typically small, off by a few bytes up to a page per segment at most.

In dotnet/runtime#72229 (and some earlier work), I introduced gc_heap::committed_by_oh and gc_heap::committed_by_oh_per_heap arrays. These arrays maintain the total number of bytes committed per heap and per object heap.

Whenever the inaccuracies are fixed, we should be able to compare the values stored in the array and the value reported by !eeheap and assert they are equal.

Activity

  1. added
    bug
    on Oct 24, 2022
  2. added this to the 8.0.0 milestone on Oct 25, 2022
  3. leculver commented on Feb 27, 2023

    @leculver
    Contributor

    @cshung Is it ok if I assign this to myself and start working on it?

  4. cshung commented on Feb 27, 2023

    @cshung
    ContributorAuthor

    @cshung Is it ok if I assign this to myself and start working on it?

    Sure

  5. assigned and unassigned on Feb 27, 2023
  6. leculver commented on Apr 15, 2023

    @leculver
    Contributor

    I have fixed this in ClrMD. PR #3823 has the fixed version.

  7. ghost closed this as completedin #3835on Apr 15, 2023
  8. ghost locked as resolved and limited conversation to collaborators on Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugsos

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions