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.