Skip to content

Fix kB-to-bytes conversion in Linux smaps parsing - #119

Merged
djberg96 merged 1 commit into
djberg96:mainfrom
mlarraz:fix/smaps-kb-to-bytes-conversion
Feb 25, 2026
Merged

Fix kB-to-bytes conversion in Linux smaps parsing#119
djberg96 merged 1 commit into
djberg96:mainfrom
mlarraz:fix/smaps-kb-to-bytes-conversion

Conversation

@mlarraz

@mlarraz mlarraz commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The smaps parser multiplied kB values from /proc/[pid]/smaps by 1000 to convert to bytes
  • kB in /proc means kibibytes (1024 bytes), not 1000
  • This caused all smaps memory metrics (pss, rss, uss, vss, swap) to be underreported by approximately 2.4%

Test plan

  • Existing test suite passes (bundle exec rake)
  • Smaps memory values are now ~2.4% higher than before (consistent with actual values)

🤖 Generated with Claude Code

The smaps parser multiplied kB values from /proc/[pid]/smaps by 1000
to convert to bytes, but kB in /proc means kibibytes (1024 bytes).
This caused all smaps memory metrics (pss, rss, uss, vss, swap) to
be underreported by approximately 2.4%.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@djberg96

Copy link
Copy Markdown
Owner

Hm, that does seem to be the case. I wonder if it was always so, but whatever, it's kb now.

@djberg96
djberg96 merged commit a0688bd into djberg96:main Feb 25, 2026
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants