Skip to content

Fix approx_bytes to prevent double-counting of SlotArena inline size#28

Merged
TKorr merged 1 commit intomainfrom
fix/approx-bytes-intrusive-list
Feb 23, 2026
Merged

Fix approx_bytes to prevent double-counting of SlotArena inline size#28
TKorr merged 1 commit intomainfrom
fix/approx-bytes-intrusive-list

Conversation

@TKorr
Copy link
Contributor

@TKorr TKorr commented Feb 23, 2026

  • Adjusted the approx_bytes method in IntrusiveList to correctly account for the size of the inline SlotArena, preventing double-counting.
  • Added a regression test to verify that approx_bytes reports the correct size for both empty and populated lists, ensuring accurate memory usage reporting.
  • Updated documentation to clarify the changes and the rationale behind the adjustments, improving understanding of memory footprint calculations.

Description

Related Issue

Fixes #

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 📝 Documentation update
  • 🔧 Refactoring (no functional changes)
  • ⚡ Performance improvement
  • 🧪 Test addition or modification

How Has This Been Tested?

  • Unit tests
  • Integration tests
  • Manual testing

Test environment:

  • OS:
  • Rust version:

Checklist

  • My code follows the project's coding standards
  • I have run cargo fmt and cargo clippy
  • I have added tests for my changes
  • All new and existing tests pass (cargo test)
  • I have updated the documentation as needed
  • I have added an entry to CHANGELOG.md (if applicable)

Screenshots (if applicable)

Additional Notes

- Adjusted the `approx_bytes` method in `IntrusiveList` to correctly account for the size of the inline `SlotArena`, preventing double-counting.
- Added a regression test to verify that `approx_bytes` reports the correct size for both empty and populated lists, ensuring accurate memory usage reporting.
- Updated documentation to clarify the changes and the rationale behind the adjustments, improving understanding of memory footprint calculations.
@TKorr TKorr merged commit 4acb207 into main Feb 23, 2026
16 checks passed
@TKorr TKorr deleted the fix/approx-bytes-intrusive-list branch February 23, 2026 15:48
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.

1 participant