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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:44:10+00:00 2026-05-16T23:44:10+00:00

Possible Duplicate: Why are structs stored on the stack while classes get stored on

  • 0

Possible Duplicate:
Why are structs stored on the stack while classes get stored on the heap(.NET)?

Can anyone tell me that how the allocation of memory is done that which object is to be stored in stack and which to be in heap portion of the memory?

  • 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-16T23:44:10+00:00Added an answer on May 16, 2026 at 11:44 pm

    3 rules of thumb:

    1. Objects are stored on the heap. These include instances of reference-types and boxed value-types.
    2. Local variables and parameters are stored on the stack. For local value-types, this means that the value itself is stored on the stack. For local reference-types, only the reference will be on the stack (Edit: Exceptions noted by Eric Lippert – value-type locals closed over outer variables, iterator-block value-types).
    3. Fields are stored where the containing instance is located. For example, a value-type field of a class will be stored on the heap. The reference-part of a reference-type field of a struct declared as a local stored on the stack will also be on the stack.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer SubSonic is able to do something like this. http://subsonicproject.com/docs/Linq_Deletes May 17, 2026 at 2:29 am
  • Editorial Team
    Editorial Team added an answer Looking in reflector you can see the top of ChangeType(object,… May 17, 2026 at 2:29 am
  • Editorial Team
    Editorial Team added an answer In your second example query, are you certain you want… May 17, 2026 at 2:29 am

Trending Tags

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

Top Members

Related Questions

Possible Duplicate: Why are mutable structs evil? I read it in lots of places
Possible Duplicate: Is it safe for structs to implement interfaces? Take this code: interface
Possible Duplicate: Can’t operator == be applied to generic types in C#? I've got
Possible Duplicates: Can you write object oriented code in C? Object Oriented pattern in
Possible Duplicate: Why must I put a semicolon at the end of class declaration
To make a struct's members private to the outside I know that I can
Possible Duplicate: C++ struct sorting Is it possible to sort a vector in C++
Possible Duplicate: Why isn’t sizeof for a struct equal to the sum of sizeof
Possible Duplicate: Why isn’t sizeof for a struct equal to the sum of sizeof
Possible Duplicate: How does a compiled C++ class look like? Hi all, bash$cat struct.c

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.