Quantcast
Channel: Active questions tagged config - Stack Overflow
Viewing all articles
Browse latest Browse all 5049

gcAllowVeryLargeObjects not working in WCF Service

$
0
0

In my C# WCF Service gcAllowVeryLargeObjects apparently isn't working. In web.config I set

<runtime>
    <gcAllowVeryLargeObjects enabled="true" />
</runtime>

The machine is x64 with 32 GB RAM. Project built with AnyCPU, "Prefer 32-bit" is unchecked. The simple code in the service to test the issue:

    public string Test(int a)
    {
        if(a == 0)
        {
            return $"Is64BitProcess: {Environment.Is64BitProcess}";
        }
        else if(a == 1)
        {
            try
            {
                int[] arr = new int[13805 * 55223];
                return "OK";
            }
            catch(Exception exc)
            {
                return exc.ToString();
            }
        }
        else
            return "nothing";
    }

on a==0, Is64BitProcess says 'true'

on a==1, I get an OutOfMemoryException: array dimensions exceeded supported range

The same code in a Windows Forms Application works fine, there is "OK" with gcAllow...="true" and OutOfMemory without it - as expected.

Any help is appreciated.


Viewing all articles
Browse latest Browse all 5049

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>