Skip to content

gc.heapSize is subject to rounding on the order of MBs #13336

Open

Description

@roberth

Is your feature request related to a problem?

It's hard to observe changes in the collectability of heap objects with NIX_SHOW_STATS.

gc.heapSize would be the measurement for this, but it is too coarse grained, and doesn't accurately reflect heap changes due to changes in expressions.

We're using this (through the _safe call instead):

Includes empty blocks and fragmentation loss. Includes some pages that were allocated but never written.

https://github.com/ivmai/bdwgc/blob/9e224cb87759c1ca420a5cd5c6082d29b9ed58cb/include/gc/gc.h#L780-L793

Proposed solution

Dig through the stats, and/or the code that produces it to figure out if we can get a better number that measures memory retention in a more fine grained manner.

Alternative solutions

Additional context

Checklist


Add 👍 to issues you find important.

Activity

  1. added
    feature
    language
    on Jun 8, 2025
  2. roberth commented on Jun 8, 2025

    @roberth
    MemberAuthor

    It would also be good to have separate stats for max heap size and final heap size, if possible.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurelanguage

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions