Skip to content

fix: optimize connection.Read to copy directly from linked buffer#415

Merged
xiaost merged 1 commit intomainfrom
fix/conn-read
Mar 5, 2026
Merged

fix: optimize connection.Read to copy directly from linked buffer#415
xiaost merged 1 commit intomainfrom
fix/conn-read

Conversation

@xiaost
Copy link
Contributor

@xiaost xiaost commented Mar 4, 2026

Add flagReadExposed to track when a node's buffer has been returned directly to user code via zero-copy Reader methods (Next, Peek, Slice, GetBytes).
Connection.Read now uses readCopy which copies from nodes without setting this flag, and only releases nodes that are not exposed.
This preserves buffer validity for prior zero-copy callers until Release.

Add flagReadExposed to track when a node's buffer has been returned
directly to user code via zero-copy Reader methods (Next, Peek, Slice,
GetBytes). Connection.Read now uses readCopy which copies from nodes
without setting this flag, and only releases nodes that are not exposed.
This preserves buffer validity for prior zero-copy callers until Release.
@xiaost xiaost requested review from a team as code owners March 4, 2026 09:57
@xiaost xiaost merged commit 81277e4 into main Mar 5, 2026
19 checks passed
@xiaost xiaost deleted the fix/conn-read branch March 5, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants