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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T14:40:03+00:00 2026-05-13T14:40:03+00:00

I am working on a .Net 3.5 application designed specifically for a high-powered PC

  • 0

I am working on a .Net 3.5 application designed specifically for a high-powered PC that does lots of data manipulation and computation. I recently encountered a need for a 4000 x 5000 two-dimensional array of objects, which is very large for a 32-bit PC and will give me an OutOfMemoryException. The only way to avoid using an array like this is by going down a very complex, time-consuming road filled with pain and suffering.

Are there any tips or tricks that the pros use to deal with large working sets of RAM? Do you know of any libraries that would be helpful (specifically for .Net)? Is there a way to force Windows to allocate more RAM for my process?

EDIT:
The array I am using will contain mostly null references, and I am using the array to keep track of adjacent objects. Seeing how most of them are null references, I would also assume there is a more efficient approach to keeping track of adjacent objects, finding a neighbor for any given object, etc.

  • 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-13T14:40:04+00:00Added an answer on May 13, 2026 at 2:40 pm

    If the majority of your elements are null, then perhaps you don’t really need to create an array at all.

    Jon suggests one approach that’ll work – implementing a sparse array using linked lists. Here’s another:

    public struct CellLocation
    {
       int Row;
       int Column;
    }
    
    public class Element
    {
       public Element(int row, int column)
       {
          Location = new CellLocation {Row = row, Column=column};
       }
    
       public readonly Location { get; private set; }
    
       // your class's other properties and methods go here
    }
    

    Now you can store Element objects in a Dictionary<CellLocation, Element>. In fact, I’d put that dictionary into a class of its own, so that it can implement methods like:

    public IEnumerable<Element> AdjacentElements(Element elm)
    {
       for (int row = -1; row <= 1; row++)
       {
          for (int column = -1; column <= 1; column++)
          {
             // elm isn't adjacent to itself
             if (row == 0 && column == 0)
             {
                continue;
             }
             CellLocation key = new CellLocation { 
                Row=elm.Location.Row + row, 
                Column=elm.Location.Column + column 
             };
             if (!Cells.ContainsKey(key))
             {
                continue;
             }
             yield return Cells[key];
          }
       }
    }
    

    There are operations for which this can be faster than a sparse array. To find the element at a single row and column, a sparse array still has to do a linear search to find the row, and then another linear search to find the column in that row, whereas this method can find an element with one lookup into a hash table.

    There are also circumstances in which it will be substantially slower. To find all the elements in a row requires as many hash-table lookups as there are cells in the row, while doing it with a sparse array just entails traversing a linked list.

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

Sidebar

Ask A Question

Stats

  • Questions 385k
  • Answers 385k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Your best option is to inject the services into the… May 14, 2026 at 11:27 pm
  • Editorial Team
    Editorial Team added an answer I've been able to reproduce your problem. In the WPF… May 14, 2026 at 11:27 pm
  • Editorial Team
    Editorial Team added an answer Can your ASP.Net MVC partial view loading routine fire off… May 14, 2026 at 11:27 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.