stack-memory Questions
4
Solved
This is just a simple theoretical question out of curiosity. I have always been like a java fan boy. But one thing makes me wonder why java does not provide mechanism for creating objects on the st...
Leishaleishmania asked 18/9, 2014 at 2:37
16
Solved
I have
class Foo {
....
}
Is there a way for Foo to be able to separate out:
function blah() {
Foo foo; // on the stack
}
and
function blah() {
Foo foo* = new Foo(); // on the heap
}
I ...
Mckoy asked 13/1, 2010 at 5:47
3
Solved
the prototype of the function ctime is
char *ctime(const time_t *timep);
As we can see, it return a string. but, where the sting be contained?
and why we shouldn't free the string's memory
Thi...
Reasoning asked 29/6, 2012 at 7:29
7
I have an array declaration like this:
int a[];
Here a is an array of primitive int type. Where is this array stored? Is it stored on heap or stack? This is a primitve type int, all primitive ty...
Longoria asked 20/1, 2010 at 7:29
2
Solved
Initially I was pretty sure that the correct answer had to be "None of them", since global variables are stored in the data memory, but then I've found this book from Robert Lafore, calle...
Aleutian asked 4/6, 2017 at 23:51
10
Solved
Ok so I understand about the stack and the heap (values live on the Stack, references on the Heap).
When I declare a new instance of a Class, this lives on the heap, with a reference to this point...
Dipterocarpaceous asked 4/1, 2012 at 16:42
31
Solved
What are the stack and heap?
Where are they located physically in a computer's memory?
To what extent are they controlled by the OS or language run-time?
What is their scope?
What determines their...
Extricate asked 17/9, 2008 at 4:18
1
The following code block launches a thread via a lambda expression. This lambda expression captures a local variable "testVar" by reference. By the time the thread function executes that ...
Middy asked 29/11, 2022 at 3:21
7
Solved
Stumbled upon this interview question somewhere,
In C,
Given a variable x, how do you find out if the space for that variable is allocated on the stack or heap?
(Is there any way to find it out p...
Allseed asked 5/12, 2012 at 9:5
2
Solved
I've been trying to figure out when things get allocated on stack and I can't figure out how would you make array (or rather values in it) get allocated on stack;
in this example:
public void foo...
Misjudge asked 28/8, 2015 at 15:1
10
Solved
How can I print out the current value at the stack pointer in C in Linux (Debian and Ubuntu)?
I tried google but found no results.
Cerography asked 18/11, 2013 at 22:52
3
Solved
Are Java records similar to C# structs? I mean, if they are stack allocated instead of using references like classes, that are allocated on heap.
Wiburg asked 9/11, 2020 at 17:42
3
I'm a beginner with operating systems, and I had a question about the OS Kernel.
I'm used to the standard notion of each user process having a virtual address space of stack, heap, data, and code....
Mag asked 8/1, 2019 at 1:43
6
Solved
I'm experiencing a bit of cognitive dissonance between C-style stack-based programming, where automatic variables live on the stack and allocated memory lives on the heap, and Python-style stack-ba...
Drugstore asked 2/6, 2012 at 21:46
3
Solved
So I've got this example C program.
int worship(long john)
{
return 0 * john;
}
int main()
{
return worship(666);
}
The assembly looks (essentially) like this:
worship(long):
pushq %rbp
mo...
Ajar asked 8/3, 2014 at 9:52
3
Solved
Is it possible to see contents of stack and heap after every line of execution. I want to see it as it will give clear idea about memory allocation and deallocation in .Net. With your
If any docu...
Ultravirus asked 25/9, 2011 at 17:45
6
Solved
Consider the following code:
class myarray
{
int i;
public:
myarray(int a) : i(a){ }
}
How can you create an array of objects of myarray on the stack and how can you create an array of obje...
Brian asked 21/10, 2009 at 2:13
4
I want to understand what is stored in the stack and heap in swift. I have a rough estimation:
Everything that you print and the memory address appears not the values, those are stored in the stack...
Kayleigh asked 12/12, 2014 at 10:19
3
In C/C++ we can store variables, functions, member functions, instances of a class either on a stack or a heap.
How is each implemented? How is it managed (high level)? Does gcc preallocates a chun...
Preconcert asked 31/7, 2009 at 14:19
2
My Golang source code is as follows.
package main
func add(x, y int) int {
return x + y
}
func main() {
_ = add(1, 2)
}
The assembly code I obtained using go tool compile -N -l -S main.go >...
Tag asked 12/5, 2022 at 14:29
4
Solved
I understand from here that std::initializer_list doesn't need to allocate heap memory. Which is very strange to me since you can take in an std::initializer_list object without specifying the size...
Stylite asked 25/5, 2022 at 12:7
5
Solved
Could anyone please give me a quick overview/point me to documentation of a way to inspect the stack (and heap?) of a C program? I thought this should be done with GDB, but if there are other more ...
Rogue asked 6/10, 2010 at 17:3
1
Solved
I've always known that reference type variables are stored in the heap while value type variables are stored in the stack. Recently, I found this picture that says that ints, doubles, strings, etc....
Firecrest asked 10/2, 2022 at 19:49
1
Solved
I'm reading "Computer Systems: A Programmer's Perspective, 3/E" (CS:APP3e) and the following code is an example from the book:
long call_proc() {
long x1 = 1;
int x2 = 2;
short x3 = 3;...
Ellita asked 2/2, 2022 at 9:33
1
Solved
I was curious about how the kernel prevents the stack from growing too big, and I found this Q/A:
Q: how does the linux kernel enforce stack size limits?
A: The kernel can control this due to the ...
Counteraccusation asked 10/1, 2022 at 18:8
1 Next >
© 2022 - 2024 — McMap. All rights reserved.