-
Notifications
You must be signed in to change notification settings - Fork 6
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
Replicate tasks slice pool causes heap allocation #75
Comments
ijsong
added a commit
that referenced
this issue
Apr 13, 2023
The `replicateTaskSlicePool` pooled slices of `replicateTask`. The function `releaseReplicateTaskSlice` received borrowed slice and then put it into `replicateTaskSlicePool`. However, the `sync.(Pool).Put` parameter is an interface, so the slice escaped to the heap unnecessarily. Not to use unnecessary heap objects, this PR wraps the `replicateTask` slice with the struct replicateTaskSlice. Resolves #75
ijsong
added a commit
that referenced
this issue
Apr 13, 2023
The `replicateTaskSlicePool` pooled slices of `replicateTask`. The function `releaseReplicateTaskSlice` received borrowed slice and then put it into `replicateTaskSlicePool`. However, the `sync.(Pool).Put` parameter is an interface, so the slice escaped to the heap unnecessarily. Not to use unnecessary heap objects, this PR wraps the `replicateTask` slice with the struct replicateTaskSlice. Resolves #75
ijsong
added a commit
that referenced
this issue
Apr 15, 2023
The `replicateTaskSlicePool` pooled slices of `replicateTask`. The function `releaseReplicateTaskSlice` received borrowed slice and then put it into `replicateTaskSlicePool`. However, the `sync.(Pool).Put` parameter is an interface, so the slice escaped to the heap unnecessarily. Not to use unnecessary heap objects, this PR wraps the `replicateTask` slice with the struct replicateTaskSlice. Resolves #75
ijsong
added a commit
that referenced
this issue
Apr 15, 2023
### What this PR does The `replicateTaskSlicePool` pooled slices of `replicateTask`. The function `releaseReplicateTaskSlice` received borrowed slice and then put it into `replicateTaskSlicePool`. However, the `sync.(Pool).Put` parameter is an interface, so the slice escaped to the heap unnecessarily. Not to use unnecessary heap objects, this PR wraps the `replicateTask` slice with the struct replicateTaskSlice. ### Which issue(s) this PR resolves Resolves #75
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Reclaiming replicate tasks slice to the pool causes unnecessary heap allocations since the type of argument in
sync.(*Pool).Put
is an interface.We need to convert the type of pool element from slice to pointer type.
The text was updated successfully, but these errors were encountered: