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 8410735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:15:22+00:00 2026-06-10T00:15:22+00:00

I have a fairly large, fairly simple, array that’s tracking 750,000 entries. In 64-bit

  • 0

I have a fairly large, fairly simple, array that’s tracking 750,000 entries. In 64-bit .NET it works fine; however on the 32-bit client it’s failing with an OutOfMemory exception. I know I’m not running out of memory. The client needing this program, cannot use the 64-bit version.

The following pseudo code compiles (edit: the original code did not compile due to a typo, this has been fixed) and, throws the same exception, when targeting the x86 architecture, on two machines:

  • A Windows XP, 32-bit machine, running 4 GB of RAM and .NET Framework 4
  • A Windows 7, 64-bit machine, running 8 GB of RAM and .NET Framework 4

Edit: Switching the compiler flag to explicitly to target the x64 architecture allows it to run on the Windows 7, 64-bit machine.

using System;

public class Storage
{
    Storage futureStorage;
    int count;
    int years;
    bool isTest;
    bool isSet;
}

public static class Program
{
    public static void Main()
    {
        Storage[] storageArray = new Storage[750000];
        for (int i = 0; i < 750000; i++)
        {
            storageArray[i] = new Storage();
        }
    }
}

Edit:

The network this code is running on is a closed network, no external network connection, so posting more exact code and relevant exception details is a bit more of a process that I am working on. I do have intellitrace running, with full debug symbols and a few compiler switches, more details to follow as soon as I port it over to an internet connected network.


On both machines, the code bombs out around an index of 693,000 (693,002 on XP, 693,646 on Windows 7 to be exact).

Anyone have any ideas as to what the issue might be? When I do a dump and profile after the code, I’m barely using 25 MB of RAM.

I’d switch to unsafe/unmanaged if it buys me anything, but the only attempt I’ve made at it makes me unable to use my Storage class.

Update:

Seems several folks are unable to replicate the issue (including myself on a different machine/network).

However, I came up with a solution (using LINQ) that eases the problem, it only throws the exception 1/5 times or so now, anyone know if there’s any issues or caveats I should be aware of using this solution, and why internally it might work compared to the other one?

using System;
using System.Linq;    

public class Storage
{
    Storage futureStorage;
    int count;
    int years;
    bool isTest;
    bool isSet;
}

public static class Program
{
    public IEnumerable<Storage> storageEnumerable;
    public static void Main()
    {
        storageEnumerable = (from x in  Enumerable.Range(0, 750000) select new Storage() {count = x});
        foreach (Storage s in storageEnumerable)
            Console.WriteLine(x);
    }
}

The above LINQ code uses far less memory, but the exception still occurs; and only on machines in this network, not on other machines outside of the network (or within an IIS application pool for that matter).

Considering other users have since reported not being able to reproduce the bug, it seems to possibly be environment or hardware specific. Could there be a network monitoring tool, or anti-virus program triggering on these two code implementations? If so, is there a better/recommended way to initialize the array so that I avoid that?

  • 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-06-10T00:15:23+00:00Added an answer on June 10, 2026 at 12:15 am

    Maybe this will help?

    What is the Maximum Size that an Array can hold?

    The answer says maybe using List may use less memory.

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

Sidebar

Related Questions

I have a fairly simple C# application that has builds a large hashtable. The
I have a fairly large webapp that I run on a Media Temple server.
I have a fairly large application that uses WPF for its user interface. I
We have a fairly simple program that's used for creating backups. I'm attempting to
I have a fairly large chunk of code that produces/returns an arraylist of search
I work on a fairly simple but large two-tier application that consists approximately 40
I have a web application that uses a fairly large table (millions of rows,
I have a fairly large, sophisticated algorithm that uses a std::priority_queue . In some
I have a fairly large C++ application (on Windows, no other platforms planned), which
I have a fairly large Excel file. In this file there is a column

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.