Skip to content

Extend Zstandard SmallestSize test fallback to Apple mobile platforms - #132701

Open
rzikm with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-memory-issue-in-zstandard-stream-tests
Open

Extend Zstandard SmallestSize test fallback to Apple mobile platforms#132701
rzikm with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-memory-issue-in-zstandard-stream-tests

Conversation

Copilot AI commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

ZstandardStreamUnitTests intermittently throws OutOfMemoryException on physical tvOS devices (~2 GB RAM) because CompressionLevel.SmallestSize maps to Zstd's max-quality mode, which needs 800+ MB of working memory.

Root cause

The test helper already downgrades SmallestSizeOptimal for 32-bit processes for the same memory reason, but the check didn't account for memory-constrained Apple mobile devices (iOS/tvOS/MacCatalyst).

Fix

  • Extended the fallback condition in CompressionStreamUnitTests.Zstandard.cs to also trigger when PlatformDetection.IsAppleMobile is true, covering both CreateStream(Stream, CompressionLevel) overrides.
if ((PlatformDetection.Is32BitProcess || PlatformDetection.IsAppleMobile) && level == CompressionLevel.SmallestSize)
{
    level = CompressionLevel.Optimal;
}

This is a test-only change; no product code is affected.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
16 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Co-authored-by: rzikm <32671551+rzikm@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix OutOfMemoryException in ZstandardStreamUnitTests Extend Zstandard SmallestSize test fallback to Apple mobile platforms Aug 24, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

Copilot AI requested a review from rzikm August 24, 2026 13:47
@rzikm
rzikm marked this pull request as ready for review August 24, 2026 13:53
@rzikm
rzikm requested review from a team and a lite review from Copilot August 24, 2026 13:53
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the Zstandard test stream factory in System.IO.Compression tests to avoid using CompressionLevel.SmallestSize on platforms where it is known to require very large working memory, by downgrading it to CompressionLevel.Optimal when running on Apple mobile platforms (in addition to the existing 32-bit fallback).

Changes:

  • Extend the existing SmallestSize -> Optimal fallback to also apply on PlatformDetection.IsAppleMobile.
  • Apply the same fallback consistently across both CreateStream(Stream, CompressionLevel) overloads.
  • Update the accompanying comment to document the Apple mobile rationale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

[ci-scan] Test failure: ZstandardStreamUnitTests OutOfMemoryException on tvOS CoreCLR

3 participants