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

requestbatcher: nil unused slice entries in batchQueue heap #85159

Merged

Conversation

nvanbenschoten
Copy link
Member

This change nils out unused entries in the batchQueue's slice when the slice is truncated to avoid retaining references to batches of requests and preventing them from being GCed.

The change also removes a redundant update of the batchQueue's byRange map. The delete was redundant because heap.Remove already calls Pop.

I found this while looking at https://github.com/cockroachlabs/support/issues/1707, but I don't think this is actually the cause of the perceived memory leak.

This change nils out unused entries in the batchQueue's slice when the
slice is truncated to avoid retaining references to batches of requests
and preventing them from being GCed.

The change also removes a redundant update of the batchQueue's byRange
map. The `delete` was redundant because `heap.Remove` already calls `Pop`.
@nvanbenschoten nvanbenschoten requested a review from ajwerner July 27, 2022 20:04
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@nvanbenschoten nvanbenschoten marked this pull request as ready for review July 27, 2022 20:06
@nvanbenschoten nvanbenschoten requested a review from a team as a code owner July 27, 2022 20:06
Copy link
Contributor

@ajwerner ajwerner left a comment

Choose a reason for hiding this comment

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

:lgtm: thanks!

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @nvanbenschoten)

@nvanbenschoten
Copy link
Member Author

TFTR!

bors r+

@craig
Copy link
Contributor

craig bot commented Aug 1, 2022

Build succeeded:

@craig craig bot merged commit 7dae9c4 into cockroachdb:master Aug 1, 2022
@nvanbenschoten nvanbenschoten deleted the nvanbenschoten/reqBatcherLeak branch August 8, 2022 17:27
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.

3 participants