Skip to content

Call the footprint estimate allocator accounting, not RSS - #975

Open
jbachorik wants to merge 3 commits into
a2-paired-estimatorfrom
a3-estimator-wording
Open

jbachorik wants to merge 3 commits into
a2-paired-estimatorfrom
a3-estimator-wording

Conversation

@jbachorik

Copy link
Copy Markdown
Collaborator

Summary

Correct wording that equates the per-object allocation estimate with resident memory. Tracker: PROF-16568. Stacked on #972. Wording only — no behavior change. (Re-opens the content of #973, which was merged while still a draft and in a confused head state — its merge was a no-op and added no commit; this PR carries the actual A3 commit.)

The MallocFootprint/NativeMem comments call the per-object estimate the "real resident cost" and "what RSS actually pays". That is refuted by measurement: with the same estimate, measured residency differs by 2× at 8192 B between glibc and musl — the estimate is allocator accounting (usable size plus the probed header), blind to occupancy. Anyone reading those comments as an RSS budget will be wrong by factors.

What changed

  • mallocFootprint.h: class and overheadOf comments now describe per-object allocator accounting.
  • nativeMem.h: _overhead and recordAlloc comments likewise.
  • ProfilerMemoryRequirements.md, ProfilingEngines.md: one sentence each describing chunk_overhead (native_mem_chunk_overhead_bytes.) the same way.
  • mallocArenaStats_ut.cpp (InterleavedSurvivorsStrandFreeChunksBeyondTrim): the comment, the [TRIM] printf and the EXPECT_GT message no longer claim malloc_trim "reclaims" memory — mallinfo2().fordblks is free-held accounting and cannot see an madvise release. The assertion conditions are byte-identical.

Not changed

No computation, counter name (native_mem_chunk_overhead_bytes.), or assertion condition. The gtest was verified green in a glibc container on this candidate (gtestDebug_mallocArenaStats_ut, 3/3 passed, reworded printf visible). spotlessCheck + qualityChecks green; agentic review (sphinx, quick) clean — 0 findings across all 8 regions.

@jbachorik jbachorik added the AI label Nov 10, 2026
@jbachorik
jbachorik added this pull request to stack #976 November 10, 2026 21:11
@dd-octo-sts

dd-octo-sts Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Scan-Build Report

User:runner@runnervmccnms
Working Directory:/home/runner/work/java-profiler/java-profiler/ddprof-lib/src/test/make
Command Line:make -j4 all
Clang Version:Ubuntu clang version 21.1.8 (6ubuntu1)
Date:Mon Nov 16 17:01:05 2026

Bug Summary

Bug TypeQuantityDisplay?
All Bugs2
Logic error
Dereference of null pointer1
Unused code
Dead initialization1

Filter Results by File

Reports

Bug Group Bug Type ▾ File Function/Method Line Path Length
Unused codeDead initializationreferenceChains.cppapplyOomRamp4971
Logic errorDereference of null pointerperfEvents_linux.cppunregisterThread72026

@dd-octo-sts

dd-octo-sts Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

CI Test Results

Run: #43913472750 | Commit: 2160e24 | Duration: 20m 15s (longest job)

✅ All 32 test jobs passed

Status Overview

JDK glibc-aarch64/debug glibc-amd64/debug musl-aarch64/debug musl-amd64/debug
8 - ✅ - -
8-ibm - ✅ - -
8-j9 ✅ ✅ - -
8-librca - - ✅ ✅
8-orcl - ✅ - -
11 - ✅ - -
11-j9 ✅ ✅ - -
11-librca - - ✅ ✅
17 ✅ ✅ - -
17-graal ✅ ✅ - -
17-j9 ✅ ✅ - -
17-librca - - ✅ ✅
21 ✅ ✅ - -
21-graal ✅ ✅ - -
21-librca - - ✅ ✅
25 ✅ ✅ - -
25-graal ✅ ✅ - -
25-librca - - ✅ ✅

Legend: ✅ passed | ❌ failed | ⚪ skipped | 🚫 cancelled

Summary: Total: 32 | Passed: 32 | Failed: 0


Updated: 2026-11-16 17:23:08 UTC

@dd-octo-sts

dd-octo-sts Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ All 40 integration tests passed

📊 Dashboard · 👷 Pipeline · 📦 f905a8c8

@dd-octo-sts

dd-octo-sts Bot commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Reliability & Chaos Results

⚠️ 12 memory check row(s) inconclusive — no failures Pipeline: https://gitlab.ddbuild.io/DataDog/java-profiler/-/pipelines/152060147

⚠️ profiler gmalloc aarch64Xmemory
Median host CPU pressure 26.69 is above the provisional bound
⚠️ profiler gmalloc amd64Xmemory
Median host CPU pressure 24.85 is above the provisional bound
⚠️ profiler jemalloc aarch64Xmemory
Median host CPU pressure 33.775 is above the provisional bound
⚠️ profiler jemalloc amd64Xmemory
Median host CPU pressure 10.58 is above the provisional bound
⚠️ profiler tcmalloc aarch64Xmemory
Median host CPU pressure 32.21 is above the provisional bound
⚠️ profiler tcmalloc amd64Xmemory
Median host CPU pressure 18.945 is above the provisional bound
⚠️ profiler tracer gmalloc aarch64Xmemory
Median host CPU pressure 21.035 is above the provisional bound
⚠️ profiler tracer gmalloc amd64Xmemory
Median host CPU pressure 11.135 is above the provisional bound
⚠️ profiler tracer jemalloc aarch64Xmemory
Median host CPU pressure 44.94 is above the provisional bound
⚠️ profiler tracer jemalloc amd64Xmemory
Median host CPU pressure 16.285 is above the provisional bound
⚠️ profiler tracer tcmalloc aarch64Xmemory
Median host CPU pressure 21.54 is above the provisional bound
⚠️ profiler tracer tcmalloc amd64Xmemory
Median host CPU pressure 17.86 is above the provisional bound

@jbachorik
jbachorik force-pushed the a3-estimator-wording branch 2 times, most recently from 44f13b6 to e5e74c6 Compare November 11, 2026 10:37
@jbachorik
jbachorik force-pushed the a3-estimator-wording branch from e5e74c6 to 955fdf9 Compare November 11, 2026 11:05
@jbachorik
jbachorik force-pushed the a3-estimator-wording branch from 955fdf9 to 6eac7e5 Compare November 12, 2026 10:11
@jbachorik
jbachorik marked this pull request as ready for review November 12, 2026 10:35
@jbachorik
jbachorik requested a review from a team as a code owner November 12, 2026 10:35
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T14:11:27.692109Z 99976ab Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@jbachorik
jbachorik marked this pull request as draft November 12, 2026 10:36
@jbachorik

Copy link
Copy Markdown
Collaborator Author

@DataDog review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6eac7e5fc8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: FAIL

The chunk_overhead gauge definition in ProfilerMemoryRequirements.md (and its counterpart in ProfilingEngines.md) must be corrected to describe only the excess over requested bytes — i.e. max(usable_size + header - requested, 0) — rather than the total allocator footprint, to match what NativeMem::recordAlloc() actually accumulates and Recording::writeNativeMem() exports.

Open Bits AI session

🤖 Bits Code Review · Commit 6eac7e5

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: FAIL

The documentation for chunk_overhead in both ProfilerMemoryRequirements.md and ProfilingEngines.md incorrectly describes the gauge as a total allocation footprint, when NativeMem::overhead() actually accumulates max(usable size + header − requested bytes, 0) — the excess over requested bytes only.

Open Bits AI session

🤖 Bits Code Review · Commit 6eac7e5

@jbachorik
jbachorik force-pushed the a3-estimator-wording branch from 6eac7e5 to 9488ee9 Compare November 12, 2026 17:59
@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Pipelines

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: f905a8c | Docs | Give us feedback!

@jbachorik
jbachorik force-pushed the a3-estimator-wording branch from 9488ee9 to 775ae11 Compare November 13, 2026 11:51
@jbachorik
jbachorik marked this pull request as ready for review November 13, 2026 13:59
@jbachorik jbachorik closed this Nov 13, 2026
@jbachorik jbachorik reopened this Nov 13, 2026
@jbachorik jbachorik closed this Nov 13, 2026
@jbachorik
jbachorik deleted the a3-estimator-wording branch November 13, 2026 14:05
@jbachorik
jbachorik restored the a3-estimator-wording branch November 13, 2026 14:05
@jbachorik jbachorik reopened this Nov 13, 2026

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: PASS

More details

The PR corrects wording that equated allocator accounting with RSS and removes reclamation claims based on fordblks. Computations and assertion conditions remain unchanged. The new head introduces no file changes relative to the previously reviewed head, so the prior review remains applicable. No findings remain open.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 99976ab

@jbachorik
jbachorik marked this pull request as draft November 13, 2026 14:10
@jbachorik
jbachorik marked this pull request as ready for review November 13, 2026 14:10
@jbachorik
jbachorik force-pushed the a3-estimator-wording branch from 99976ab to 33cf6d0 Compare November 13, 2026 14:34

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: PASS

More details

The revised wording distinguishes allocator accounting and free-held bytes from residency, avoiding RSS claims those counters cannot establish. Calculations and assertion conditions remain unchanged.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 33cf6d0

@jbachorik
jbachorik force-pushed the a3-estimator-wording branch from 33cf6d0 to 1fcfdb3 Compare November 13, 2026 14:41

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: PASS

More details

The revised chunk_overhead descriptions match the allocator-accounting calculation and distinguish it from resident memory. Calculations and assertion conditions remain unchanged.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 1fcfdb3

@jbachorik
jbachorik force-pushed the a3-estimator-wording branch from 1fcfdb3 to 3d99d31 Compare November 16, 2026 12:03

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: PASS

More details

The revised allocator descriptions distinguish per-object accounting from resident memory and define overhead relative to requested bytes. Computations and assertion conditions remain unchanged.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit 3d99d31

The MallocFootprint and NativeMem comments, two docs and the
arena-stats test now describe the estimate as usable size plus
the probed header; mallinfo2 free-held figures make no residency
claim. No behavior changes.
The gauge accumulates usable size plus the probed header minus the
requested allocation, not the full footprint; align the two doc
passages and the recordAlloc comment
@jbachorik
jbachorik force-pushed the a3-estimator-wording branch from 3d99d31 to f905a8c Compare November 16, 2026 16:59

@datadog-datadog-prod-us1 datadog-datadog-prod-us1 Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: PASS

More details

The revised counter descriptions correctly distinguish allocator overhead from resident memory. Calculations and assertion conditions remain unchanged, and the completed static review identified no actionable defects.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit f905a8c

This branch has not been deployed

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant