Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mem: singleSegmentArena allocates more than required #123

Closed
thsnr opened this issue Oct 2, 2018 · 1 comment
Closed

mem: singleSegmentArena allocates more than required #123

thsnr opened this issue Oct 2, 2018 · 1 comment
Labels

Comments

@thsnr
Copy link

thsnr commented Oct 2, 2018

If I am reading the source code correctly, then singleSegmentArena.Allocate allocates more memory than necessary. mem.go shows that nextAlloc is invoked with the length of data, but should be the capacity. Otherwise it is overallocating by cap(data)-len(data) bytes.

Not a big deal, just something that caught my eye.

@zombiezen zombiezen self-assigned this Oct 3, 2018
@zombiezen zombiezen added the bug label Oct 3, 2018
@zombiezen
Copy link
Contributor

Good catch! Mind sending a PR?

@zombiezen zombiezen removed their assignment Oct 3, 2018
thsnr added a commit to thsnr/go-capnproto2 that referenced this issue Oct 4, 2018
zombiezen pushed a commit that referenced this issue Oct 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants