Skip to content

Process Iri_UnicodePlane3_13 test in 0x10000-character chunks#124486

Merged
MihaZupan merged 5 commits intomainfrom
copilot/fix-out-of-memory-exception
Feb 24, 2026
Merged

Process Iri_UnicodePlane3_13 test in 0x10000-character chunks#124486
MihaZupan merged 5 commits intomainfrom
copilot/fix-out-of-memory-exception

Conversation

Copy link
Contributor

Copilot AI commented Feb 16, 2026

Description

Test Iri_UnicodePlane3_13 was failing with OOM on 32-bit platforms due to allocating ~720K characters (Unicode planes 3-13: 0x30000-0xDFFFF) in a single string.

Changes

Changed test to process the range in 11 chunks of 0x10000 characters each:

[Fact]
public void Iri_UnicodePlane3_13()
{
    // Process the range in chunks of 0x10000 to avoid allocating large strings
    for (int start = 0x30000; start < 0xE0000; start += 0x10000)
    {
        try
        {
            int end = Math.Min(start + 0x10000, 0xE0000);
            EscapeUnescapeTestUnicodePlane(start, end);
        }
        catch (OutOfMemoryException)
        {
            // Individual chunks can still cause OOM on 32-bit platforms
        }
    }
}

Peak memory allocation reduced from ~720K to ~65K characters per iteration. Maintains identical test coverage with significantly improved reliability on memory-constrained platforms.

Original prompt

This section details on the original issue you should resolve

<issue_title>Test failure: System.PrivateUri.Tests.IriTest.Iri_UnicodePlane3_13</issue_title>
<issue_description>Failed in: runtime-coreclr libraries-jitstress 20260212.1

Failed tests:

net11.0-windows-Release-x86-jitstress2-Windows.10.Amd64.Open
- System.PrivateUri.Tests.IriTest.Iri_UnicodePlane3_13

Error message:

System.OutOfMemoryException : Exception of type 'System.OutOfMemoryException' was thrown.

Stack trace:

   at System.GC.<AllocateUninitializedArray>g__AllocateNewArrayWorker|77_0[T](Int32 length, Boolean pinned) in /_/src/coreclr/System.Private.CoreLib/src/System/GC.CoreCLR.cs:line 831
   at System.Buffers.SharedArrayPool`1.Rent(Int32 minimumLength) in /_/src/libraries/System.Private.CoreLib/src/System/Buffers/SharedArrayPool.cs:line 107
   at System.Text.ValueStringBuilder.Grow(Int32 additionalCapacityBeyondPos) in /_/src/libraries/Common/src/System/Text/ValueStringBuilder.cs:line 265
   at System.UriHelper.EscapeStringToBuilder(ReadOnlySpan`1 stringToEscape, ValueStringBuilder& vsb, SearchValues`1 noEscape, Boolean checkExistingEscaped) in /_/src/libraries/System.Private.Uri/src/System/UriHelper.cs:line 276
   at System.Uri.GetCanonicalPath(ValueStringBuilder& dest, UriFormat formatAs) in /_/src/libraries/System.Private.Uri/src/System/Uri.cs:line 4202
   at System.Uri.RecreateParts(ValueStringBuilder& dest, String str, UriComponents parts, UInt16 nonCanonical, UriFormat formatAs) in /_/src/libraries/System.Private.Uri/src/System/Uri.cs:line 2893
   at System.Uri.RecreateParts(UriComponents parts, UInt16 nonCanonical, UriFormat formatAs) in /_/src/libraries/System.Private.Uri/src/System/Uri.cs:line 2729
   at System.Uri.GetEscapedParts(UriComponents uriParts) in /_/src/libraries/System.Private.Uri/src/System/Uri.cs:line 2681
   at System.Uri.GetComponentsHelper(UriComponents uriComponents, UriFormat uriFormat) in /_/src/libraries/System.Private.Uri/src/System/UriExt.cs:line 869
   at System.Uri.InternalGetComponents(UriComponents components, UriFormat format) in /_/src/libraries/System.Private.Uri/src/System/UriExt.cs:line 317
   at System.Uri.get_AbsoluteUri() in /_/src/libraries/System.Private.Uri/src/System/Uri.cs:line 777
   at System.PrivateUri.Tests.IriTest.EscapeUnescapeTestComponent(String uriInput, UriComponents component) in /_/src/libraries/System.Private.Uri/tests/FunctionalTests/IriTest.cs:line 383
   at System.PrivateUri.Tests.IriTest.VerifyUriNormalizationForEscapedCharacters(String uriInput) in /_/src/libraries/System.Private.Uri/tests/FunctionalTests/IriTest.cs:line 311
   at System.PrivateUri.Tests.IriTest.Iri_UnicodePlane3_13() in /_/src/libraries/System.Private.Uri/tests/FunctionalTests/IriTest.cs:line 244
   at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) in /_/src/coreclr/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.CoreCLR.cs:line 36
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) in /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodBaseInvoker.cs:line 57
```</issue_description>

<agent_instructions>Disable this specific test when running on 32bit as it can allocate a few hundred MB of memory</agent_instructions>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix test failure due to OutOfMemoryException Skip Iri_UnicodePlane3_13 test on 32-bit platforms to prevent OOM Feb 16, 2026
Copilot AI requested a review from MihaZupan February 16, 2026 22:55
@dotnet-policy-service
Copy link
Contributor

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

Copilot AI changed the title Skip Iri_UnicodePlane3_13 test on 32-bit platforms to prevent OOM Catch OOM in Iri_UnicodePlane3_13 test instead of skipping on 32-bit Feb 23, 2026
Copilot AI changed the title Catch OOM in Iri_UnicodePlane3_13 test instead of skipping on 32-bit Process Iri_UnicodePlane3_13 test in 0x10000-character chunks Feb 23, 2026
@MihaZupan MihaZupan added this to the 11.0.0 milestone Feb 23, 2026
@MihaZupan MihaZupan marked this pull request as ready for review February 23, 2026 14:50
Copilot AI review requested due to automatic review settings February 23, 2026 14:50
@MihaZupan MihaZupan enabled auto-merge (squash) February 23, 2026 14:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adjusts System.Private.Uri IRI functional testing to avoid OutOfMemoryExceptions on 32-bit platforms by reducing peak allocation size when exercising Unicode planes 3–13.

Changes:

  • Updates Iri_UnicodePlane3_13 to iterate the range in 0x10000-sized chunks instead of building one very large input string.

@MihaZupan MihaZupan requested a review from a team February 23, 2026 15:02
@MihaZupan MihaZupan merged commit 3b504c5 into main Feb 24, 2026
92 of 94 checks passed
@MihaZupan MihaZupan deleted the copilot/fix-out-of-memory-exception branch February 24, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test failure: System.PrivateUri.Tests.IriTest.Iri_UnicodePlane3_13

5 participants