gcAllowVeryLargeObjects is not effective for using more than 2GB in an array in C# Asp.NET - Stack Overflow

I have struct as followingpublic struct Data{public readonly long Start;public readonly long End;publ

I have struct as following

public struct Data
{
    public readonly long Start;
    public readonly long End;

    public Data(long start, long end)
    {
        Start = start;
        End = end;
    }
}
Data[] dataRange = new Data[150000000]; // here thrown "array dimensions exceeded supported range" exceptions. 

Array declaration supported only up to a length of 134217724. I assume 2GB is still limited even though it has gcAllowVeryLargeObjects enabled.

The same array is working fine with my separate ConsoleApplication whereas not working in Asp project.

I have struct as following

public struct Data
{
    public readonly long Start;
    public readonly long End;

    public Data(long start, long end)
    {
        Start = start;
        End = end;
    }
}
Data[] dataRange = new Data[150000000]; // here thrown "array dimensions exceeded supported range" exceptions. 

Array declaration supported only up to a length of 134217724. I assume 2GB is still limited even though it has gcAllowVeryLargeObjects enabled.

The same array is working fine with my separate ConsoleApplication whereas not working in Asp project.

Share Improve this question asked Mar 13 at 9:35 Gowtham DharmarajanGowtham Dharmarajan 2343 silver badges17 bronze badges 5
  • Are you sure you are running in x64? What version of ASP.Net are we talking about? – JonasH Commented Mar 13 at 10:03
  • @JonasH Environment.Is64BitOperatingSystem : true, Environment.Is64BitProcess : true, Debug setting is X64 & targetFramework is also 4.5 later. – Gowtham Dharmarajan Commented Mar 13 at 10:16
  • What is Array.MaxLength ? – JonasH Commented Mar 13 at 10:52
  • @JonasH How to check? – Gowtham Dharmarajan Commented Mar 13 at 11:22
  • The same way you check any other runtime property, like writing the property value to a logfile or run use an attached debugger to inspect the value. – JonasH Commented Mar 13 at 12:06
Add a comment  | 

1 Answer 1

Reset to default 0

For Asp web sites, we need to add gcallowverylargeobjects key in the C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config file to <runtime> section. web.config is not enough.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744710717a4589326.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信