Skip to content

Conversation

@saikocat
Copy link
Contributor

This attempts to fix #606 - MultiSegmentArena: preferred segment is not part of the arena

  • Replace []Segment with []*Segment in MultiSegmentArena to avoid address-instability on append.
  • Make Segment(id) return the stable pointer from msa.segs (no &msa.segs[id]).
  • In Allocate, validate the preferred segment in O(1) by checking seg.id is in-range and msa.segs[seg.id] == seg; remove the linear pointer scan.
  • Keep msa.segs length in sync with the byte-storage (msa.segs[i].data).
  • Ensure Release() zeroises and returns buffers, then clears pointers safely.
Copy link
Collaborator

@lthibault lthibault left a comment

Choose a reason for hiding this comment

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

LGTM. Approving once it clears CI.

@lthibault lthibault merged commit e26d1c6 into capnproto:main Oct 24, 2025
4 checks passed
@lthibault
Copy link
Collaborator

Do I need to cut a release?

@saikocat
Copy link
Contributor Author

Yes, I think so. This is due to previous version is buggy with MultiSegment.

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

Labels

None yet

2 participants