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

Change tagging to free a SegmentedList back to a pool #75873

Conversation

ToddGrun
Copy link
Contributor

The GetTags calls into our taggers require passing back an IEnumerable. Previously, we created a SegmentedList to hold all the data and then passed that back. However, that suffers from not being able to add back the returned list into a pool. Instead, switch to using yield return over the populated segmented list as that will allow the list to be freed back to the pool upon completion.

Utilizing the yield state machinery does incur an allocation, but this should be a much smaller allocation than the potentially very large arrays that our taggers were returning.

The GetTags calls into our taggers require passing back an IEnumerable. Previously, we created a SegmentedList to hold all the data and then passed that back. However, that suffers from not being able to add back the returned list into a pool. Instead, switch to using yield return over the populated segmented list as that will allow the list to be freed back to the pool upon completion.

Utilizing the yield state machinery does incur an allocation, but this should be a much smaller allocation than the potentially very large arrays that our taggers were returning.
@ToddGrun ToddGrun requested a review from a team as a code owner November 12, 2024 19:26
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead VSCode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants