summaryrefslogtreecommitdiff
path: root/tests/src/GC/Stress/Tests/LargeObjectAllocPinned.cs
blob: 919d7005bb009ea4b4677c94f8b8ac3922cd3779 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

// Regression Test for Bug# 145842(Possible GC hole with byrefs into the large heap)

using System;
internal class LargePinned
{
    [System.Security.SecuritySafeCritical]
    unsafe public static int Main(String[] args)
    {
        for (int i = 0; i < 25; i++)
        {
            byte[] x = new byte[130000];
            fixed (byte* z = x)
            {
                for (int j = 0; j < 100; j++)
                {
                    byte[] y = new byte[120000];
                }
                *z = 23;
            }

            TestLibrary.Logging.WriteLine("End of Loop: {0} \n", i);
        }
        TestLibrary.Logging.WriteLine("Test Passed\n");
        return 100;
    }
}