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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T13:13:34+00:00 2026-05-25T13:13:34+00:00

I am not sure how appropriate is this question, but – I am curious

  • 0

I am not sure how appropriate is this question, but –

I am curious about how the compiler sets memory aside for an object (allocation of memory) even before it is constructed (before even the constructor is called!).

How does it happen for primitive datatypes?

This sounds a bit naive, but what exactly is it ?

Is it entirely a run time process, or does it (the compiler) have any plans like to do this, to do that, during run-time, which it decides before hand during the compile- time. I have no idea at all!

An object, be it a primitive type, a pointer, or a instance of a big class, occupies a certain known amount of memory. That memory must somehow be set aside for the object. In some circumstances, that set-aside memory is initialized. That initialization is what constructors do. They do not set aside (or allocate) the memory needed to store the object. That step is performed before the constructor is called.

In other words, when does the memory allocation for literally ANY kind of variable happen, in terms of time, at which point? At which step in compilation (or run-time)?

  • 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-25T13:13:35+00:00Added an answer on May 25, 2026 at 1:13 pm

    Memory allocation always happens at run time. Memory reservation, for objects that reside on the stack, or for static variables, happens at compile time (or at run time for C99 VLAs).

    Memory for an object’s members is always in place before the constructor runs. It is the job of the compiler and its runtime support to ensure that is so.

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

Sidebar

Related Questions

I'm not sure this question is appropriate here but I hope I could get
Im not sure if this question is appropriate to go in here but after
Not sure if this is an appropriate programming question or not; but here goes....
I'm not 100% sure that this is an appropriate question for SO but here
Not sure if this is the appropriate place for this question, but it seems
Not sure if this is an appropriate forum to ask this question, but I've
I am not sure whether this forum is appropriate for this question. But, I
I'm not sure if this question is appropriate for SO, but I'm sure a
I'm not sure if this kind of question is appropriate, but its been suggested
Not sure how to go about this, but basically I wrote a tooltip plugin

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.