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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T16:04:37+00:00 2026-05-31T16:04:37+00:00

I am using C#, .NET 4.0, 64-bit. I need to store in memory 500

  • 0

I am using C#, .NET 4.0, 64-bit. I need to store in memory 500 million “data points” that are used in computations. I need to decide whether to create these as struct or class objects. Structs seem so much faster.

Is there a memory limit for the stack? If so, how can it be adjusted.

Will storing so much data on a stack affect the overall performance of the system?

(By the way, I am aware of the single-object size limitation in .NET, so that’s being addressed — the data will be stored in multiple collections).

  • 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-31T16:04:38+00:00Added an answer on May 31, 2026 at 4:04 pm

    You’re asking the wrong question. If stack size matters, you’re doing something wrong.

    If you use many datapoints, you’ll put them in a collection, such as an array. Arrays are always allocated on then heap. An array of structs embeds the individual structs and forms a continuous memory block. (If you have more than 2GB, you need several arrays).

    Whereas with reference types, the array will only contain the references, and the objects get allocated individually on the heap. A heap allocation has about 16 bytes of overhead, the reference in the array accounts for another 8.
    You’ll also get worse cache locality due to the indirections, and the GC has to do more work, to crawl all those references.

    My conclusion is that if you have many small datapoints, make them a struct, and put them in an array.

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

Sidebar

Related Questions

I need to perform a 128-bit RC4 encryption, I'm using .NET and C#. Is
Ok, I need to store/retrieve a bit from a data table of 3.268.760 bits
Has anyone had any luck of using Oracle from .Net on a 64 bit
My problem is a bit complicated: I am writing in c#, asp.net and using
Using c#, VS2005, and .NET 2.0. (XP 32 bit) This is a Winforms app
Using .NET 1.1, I have a DataGrid that contains three columns for each row.
I have worked a bit with ASP.NET before. I was using a MS SQL
I need a special operator that's maybe a bit better than LIKE to query
I am using Windows 7 Enterprise 32 bit. I have used Windows command line,
I have a bit of experience in creating web applications using asp.net however I

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.