Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [stack-memory]

Questions regarding process stack memory. Generally, stack memory is sequentially allocated, scoped to successive function calls, and normally referenced by the CPU using a stack pointer register.

stack-memory
-2 votes
0 answers
52 views

c++ heap vs stack allocation for append function call [duplicate]

If I have a string in C++: std:string a = std:string("haha"); Does it get allocated on the stack since it's a local variable? Or since it's the std::string type, does it directly go on the ...
hooistheman's user avatar
0 votes
1 answer
67 views

How does array padding works in Stack?

The following question refers to x86 assembly, and little endianness. Suppose I have the following code in C: unsigned char myID[10] = "211866744"; How will this array be saved in memory? ...
David's user avatar
  • 53
-3 votes
2 answers
63 views

Define/Initialize Vectors on Stack vs Heap [closed]

I declare two vectors in my class header file as follows: struct MYDATA { uint8_t A = 0; uint8_t B = 0; }; std::vector<MYDATA> vector1; std::vector<MYDATA> *vector2 = new std::...
Torisoft's user avatar
-3 votes
1 answer
79 views

How is Numpy able to get an array size at run-time?

In C++ the size of an array must be determined at the compile-time. I want to write a simple code in C++, say, to do a naive matrix multiplication with itself (for a matrix that is square in size) and ...
MOON's user avatar
  • 2,732
2 votes
2 answers
93 views

If the stack grows downwards, how does it not overlap with other stuff in the address space?

I realized I never really thought of this. If I made a large enough recursive call chain, wouldn't the stack eventually grow down enough that it will overlap with other things, like shared libraries (...
natitati's user avatar
  • 167
0 votes
1 answer
68 views

Stack size in relation to virtual memory

In our Operating Systems class we mentioned virtual memory as a mechanism that abstracts physical memory to a process, and that it looks something like this (per process): The stack grows down the ...
lukascobbler's user avatar
5 votes
1 answer
91 views

Why does the Stack Pointer in MIPS Typically Start at 0x7FFFFFFC but not 0x80000000?

According to Patterson & Hennessy's Computer Organization and Design (MIPS Edition), the stack pointer $sp is typically initialized to 0x7FFFFFFC. the stack pointer $sp is always pointing at the ...
Flandia Yingman's user avatar
0 votes
2 answers
102 views

Does Stack being limited in size mean i can only get limited pointers to objects in heap?

if stack size is 1MB, does that mean i can only get less than 1000000/8 pointers to allocate ints in heap? (considering 1MB free stack) yeah i know you might not want to make that many individual ints ...
Nemexia's user avatar
  • 139
-3 votes
2 answers
125 views

Why is there no time cost to large stack allocations

I tried this quick-bench test and I'm finding that it's the same cost timewise to allocate 200 bytes as it is to allocate 2000000 bytes. How could that possibly be?
bobobobo's user avatar
  • 66.6k
0 votes
0 answers
13 views

How to assign the stack/heap area into the external ram

How could I assign the stack/heap area into the external RAM on the KEIL SDK. My scatter file is like the following. LR_IROM1 0x01008000 0x00400000 { ; load region size_region ER_IROM1 ...
andy's user avatar
  • 117
0 votes
0 answers
38 views

With what part of the program are the stack and heap associated?

I understanding the stack, the LIFO working principle, memory allocation on the heap and stuff. My question is, where does this exists ? Is there a dedicated region on the ram for the stack ? Or is it ...
Out Bruh's user avatar
0 votes
3 answers
125 views

Get stack trace from ELF and stack hex

I'm working on a core dump mechanism for STM32 mcus running FreeRTOS. I managed to extract the stack of the running tasks, and transmit it to a server where a python script writes it into a hex file. ...
KubbyDev's user avatar
-3 votes
1 answer
84 views

pointers from heap and instances from stack C++ [closed]

My purpose is to determine if I should deallocate using delete a variable to a pointer stored in a linked list... I had the idea to consider that any pointer allocated in the heap will be strictly ...
David Harouche's user avatar
0 votes
0 answers
54 views

"Symbol not defined : @STACK " error in ASM code for 8086. Compiled using DOSBOX ,MASM

This is a code to add all numbers between 50 and 150 and display the result in decimal form.I have created the stack segment .STACK 32 to store the remainders to convert the hex result to decimal ...
Bishal Lamichhane's user avatar
-4 votes
1 answer
91 views

C-Dynamic Memory Allocation

typedef struct { double x; double y; } point; point p1; point* p2 = malloc(sizeof(point)); In this code where the variables p1,p2,p1.x, and p2->x are stored in stack or heap memory? Where ...
Suthekshan 's user avatar

15 30 50 per page
1
2 3 4 5
69