Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6670949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:19:44+00:00 2026-05-26T03:19:44+00:00

In .Net framework 2 GiB is the highest memory that you can allocate for

  • 0

In .Net framework 2 GiB is the highest memory that you can allocate for an object. This fact is independent from platform (x64 or x86 or …).
I need to have a huge list with more than 2^30 Complex Numbers (each one is 16 bytes).

Note:

As with 32-bit Windows operating systems, there is a 2GB limit on the
size of an object you can create while running a 64-bit managed
application on a 64-bit Windows operating system.

from http://msdn.microsoft.com/en-us/library/ms241064%28VS.80%29.aspx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T03:19:44+00:00Added an answer on May 26, 2026 at 3:19 am

    I’d implement a wrapper class that uses multiple arrays internally.

    Similar to the following:

    void Main()
    {
        long count=3*1024*1024;
        var arr=new LargeArray<Complex>(count,12);
        for(long i=0;i<count;i++)
        {
          arr[i]=new Complex(i,-i);
        }
        for(long i=0;i<count;i++)
        {
          if(arr[i].R!=i)
            throw new Exception("Fail"+i+" "+arr[i].R);
        }
    }
    
    struct Complex
    {
      public double R,I;
    
      public Complex(double r,double i)
        {
          R=r;
          I=i;
        }
    }
    
    
    class LargeArray<T>
    {
      private readonly int partBits;  
      private readonly long size;
    
      private T[][] data;
    
      public T this[long index]
      {
        get
        {
          if((ulong)index>=(ulong)size)
            throw new IndexOutOfRangeException();
          int part=(int)(index>>partBits);
          int subIndex=(int)(index&((1<<partBits)-1));
          return data[part][subIndex];
        }
        set
        {
          if((ulong)index>=(ulong)size)
            throw new ArgumentOutOfRangeException();
          int part=(int)(index>>partBits);
          int subIndex=((int)index&((1<<partBits)-1));
          data[part][subIndex]=value;
        }
      }
    
      public LargeArray(long size,int partBits)
      {
        this.size=size;
        this.partBits=partBits;
        int partSize=1<<partBits;
        int partCount=(int)(((size-1)>>partBits)+1);
        data=new T[partCount][];
        for(int i=0;i<partCount;i++)
          data[i]=new T[partSize];
      }
    }
    

    If you use a 64 bit process this works beyond 2GB. I tried it with 5GB and apart from swapping my comp to a halt it worked.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using C# .NET Framework 2.0 to create application that can pick up clicked
My requirement is to create a framework that can consume standard ASP.NET Profile provider.
Using .Net framework 4. I am assuming this log4net version that the PayPal library
I know that .Net framework runtime is contained in mscoree.dll.Can anyone help me in
.NET framework 3.5 introduces Action and Func<> predefined delegate types that are very handy.
.Net framework contains a great class named Convert that allows conversion between simple types,
On .NET Framework 2.0 AutoResetEvent and ManualResetEvent inherit from EventWaitHandle. The EventWaitHandle class has
The .NET Framework has unmanaged debugging and profiling APIs that I assume people/companies are
Is there a .NET framework interface like this? public interface IEvent { event EventHandler
We know that .NET framework class encapsulate the Win32 API, now I am wondering

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.