Skip to content

cleanup memory after UnflushedBytes_HandlesLargeValues test #117115

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

pedrobsaila
Copy link
Contributor

Fixes #117090

@github-actions github-actions bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Jun 28, 2025
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Jun 28, 2025
@teo-tsirpanis teo-tsirpanis added area-System.IO.Pipelines and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Jun 29, 2025
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
{
await writer.FlushAsync();
await writer.CompleteAsync();
GC.Collect(2, GCCollectionMode.Forced, true, true);
Copy link
Member

@stephentoub stephentoub Jun 30, 2025

Choose a reason for hiding this comment

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

Why does this help?

Won't other tests running concurrently still experience low memory conditions?

And shouldn't the GC be automatically doing a collection if the memory pressure is so high? And even if it does a collection, that's not going to guarantee it gives the memory back to the OS, and it's the OS' OOM killer that's affecting this, right?

Copy link
Contributor Author

@pedrobsaila pedrobsaila Jul 1, 2025

Choose a reason for hiding this comment

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

I forced a compacting Gen 2 GC in the hope that it frees enough memory to have some non-ephemeral segments returned to the OS. But as you said, there's no guarantee. I'll investigate a bit more thoroughly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.IO.Pipelines community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Android] System.IO.Pipelines.Tests.PipeWriterTests.GetMemoryFlushWithACompletedReaderNoops causes the test to fail due to memory pressure
4 participants