My understanding is that static memory such as the stack, virtual tables, static variables, ect are all allocated at "compile time" as opposed to dynamic memory which is allocated at runtime. But I'm confused as to what this means. As I understand it the compiler/linker interprets the written code, translates it into machine language, and then assembles it into an executable. Is the implication that the stack and all static memory are part of the executable file itself?
What does it mean for memory to be allocated at "compile time"?
166 Views Asked by NickyBugs At
1
There are 1 best solutions below
Related Questions in C++
- How to immediately apply DISPLAYCONFIG_SCALING display scaling mode with SetDisplayConfig and DISPLAYCONFIG_PATH_TARGET_INFO
- Why can't I use templates members in its specialization?
- How to fix "Access violation executing location" when using GLFW and GLAD
- Dynamic array of structures in C++/ cannot fill a dynamic array of doubles in structure from dynamic array of structures
- How do I apply the interface concept with the base-class in design?
- File refuses to compile std::erase() even if using -std=g++23
- How can I do a successful map when the number of elements to be mapped is not consistent in Thrust C++
- Can std::bit_cast be applied to an empty object?
- Unexpected inter-thread happens-before relationships from relaxed memory ordering
- How i can move element of dynamic vector in argument of function push_back for dynamic vector
- Brick Breaker Ball Bounce
- Thread-safe lock-free min where both operands can change c++
- Watchdog Timer Reset on ESP32 using Webservers
- How to solve compiler error: no matching function for call to 'dmhFS::dmhFS()' in my case?
- Conda CMAKE CXX Compiler error while compiling Pytorch
Related Questions in STACK
- What is causing my towers of hanoi logic to infinitely loop?
- Asking code suggestions about data structure and algorithm
- Why is 'EDITBIN /STACK:2097152 w3wp.exe' cmd is giving me an LNK1342 error?
- issues with circular queues
- Missing PAGE_GUARD flag on the memory of stack for one windows application
- Purpose of stack register(s) in holding 0x7c00
- Split Dataframe and stack horizontally
- segmentation fault (core dumped) in C programming
- How to find Find max right using stack?
- Does an Stackoverflow occur in the JVM if the Activation Record is too small but there is still space left in the general stack?
- How to create 100 maps with bootstrapping using stacked ensemble fit with tidymodels
- How does the class Exchanger in Java actually work?
- How can I improve the iterative approach to be faster than recursive implementation, as usual?
- Need to make Stack cards on nav click as well ass page scroll with help of jquery
- Puncover: Stack column is empty after analysis
Related Questions in COMPILE-TIME
- How to check if a macro argument is an integer literal in C
- Why can I not get a compile-time error referencing a non-existent key in a Dart map?
- Placing data at an address given by a constant arithmetic expression
- Is there an effective way to assert an constexpr-if branch is executed?
- What is the storage duration and lifetime of a non type template parameter and how can it be used for compile-time computation?
- How to Create constexpr Array Where Elements Depend on the Array’s Size?
- Replace (annotated methods/methods which meet condition) on compile-time in Java
- C++ templates: choice between static and dynamic allocations (a la Eigen)
- Thread Safe Compile Time Array
- Why is stack memory usage in C++ determined at compile time?
- Initialize member array at compile time
- Rust error : doesn't have a size known at compile-time
- Check if a floating point type is a superset of another floating point type
- Lifetime of literal values inside Zig comptime function
- Is there any substitution for compile time hash as template arguments
Related Questions in STATIC-MEMORY-ALLOCATION
- Malloc memory assigned pointer living on a static variable is auto freed or its really a leak?
- Parameterizing type definition at compile time
- Changing from dynamic memory to static memory
- Memory Allocation of Instance Variables
- Why are there empty spaces among stack memory allocated in C?
- Is there any program (similar to Valgrind) that can be used to find the amount of statically allocated memory (given a bin file)?
- C++ Compiling Static Arrays of Unknown Type
- Static objects use across multiple translation units
- Why does calling a function in a different order cause a segmentation fault in C?
- How to force a static library at a specific memory address
- How can I declare a zero initialized vector in Assembly AT&T in the .bss section?
- If a static variable is declared out side of a function, will the memory address be the same as if it's declared in a function
- How rust store Strings in arrays?
- Is there any way to allocate exact physical memory address with caching in ubuntu?
- How is static array expanding itself?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Sort of. It is determined at compile time how the memory will be allocated when a block is entered. But the allocation doesn't happen until runtime.
Depends on what you mean by that. The executable file does indeed contain information about memory that will be allocated. For example, if the compiler knows that it needs to allocate 64 bytes on the stack, then there would be an instruction that adjusts the frame pointer by 64 bytes (or something along those lines).
None of this is specified by the language itself, so everything is up to the language implementation to decide and varies between different language implementations. My explanation is simplified and describes a hypothetical language implementation and might not be accurate to whatever language implementation you use.