Skip to main content
Filter by
Sorted by
Tagged with
3 votes
1 answer
179 views

I was reading an article on the Memory Layout of C Programs; https://www.geeksforgeeks.org/c/memory-layout-of-c-program/. It mentioned, under "4. Stack Segment": When the stack and heap ...
Supreeto's user avatar
  • 339
17 votes
3 answers
1k views

I'm reading a GNU as introductory book for programs running on top of an OS. I'm at the stack memory part and I was curious how the stack looks like in a freestanding environment. I'm guessing that ...
mltm's user avatar
  • 605
1 vote
1 answer
222 views

I've been messing around with assembly and compilers & have gotten a lot of conflicting information in how I should be using registers, the stack / spill over registers, and to what extent ...
Dak's user avatar
  • 51
0 votes
1 answer
86 views

I want to understand how memory is allocated to function params in c. I compiled the same program twice with gcc -g except I interchanged the first and second params of a function on_menu for the ...
Groot's user avatar
  • 19
1 vote
1 answer
88 views

Considering that the type A is defined like this: typedef struct a { const int a; } A; I know that this code is valid: A * foo = malloc(sizeof *foo); // Allocates uninitialized memory with no ...
Fayeure's user avatar
  • 1,483
2 votes
0 answers
128 views

I know each segment in the executable file need to be aligned, before loaded into ram there were aligned to minimum page size of 4096 bytes and if there not enough fit within 4096 bytes they span ...
Nalan PandiKumar's user avatar
0 votes
0 answers
66 views

Are local variables always volatile in C#? In other words, is the volatility of num the same in these two classes: public sealed class ThreadSafeObjectA { private volatile int num; public int ...
user3163495's user avatar
  • 3,968
1 vote
4 answers
160 views

If each process has its own address space and it is much larger than the physical memory of the computer, why can’t we just place the stack at the end of this address space and the heap at the ...
omnit's user avatar
  • 13
1 vote
0 answers
101 views

I'm working on an assembler-disassembler tool in x64 assembly on Windows, and I'm encountering a strange issue related to function calls and stack alignment. The program is supposed to support basic ...
kavi castelo's user avatar
1 vote
1 answer
75 views

I have a value on the stack, and I want to store it at a constant address in memory. Would the operation take the address from the stack first, I could put the address on the stack and store the value ...
matj1's user avatar
  • 344
-3 votes
1 answer
154 views

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,871
0 votes
1 answer
256 views

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
0 votes
2 answers
134 views

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
0 votes
0 answers
44 views

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
0 answers
93 views

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
0 votes
0 answers
49 views

The following snippet comes from the lesson 7 on asmtutor.com : ;------------------------------------------ ; void sprintLF(String message) ; String printing with line feed function sprintLF: call ...
vmonteco's user avatar
  • 15.9k
1 vote
1 answer
504 views

There doesn't seem to be any mention of a "Red Zone" for Aarch64 in the ABI, but Microsoft makes reference to a 16-byte red zone for Aarch64, Apple claims a 128-byte red zone in Writing ...
David C. Rankin's user avatar
-3 votes
1 answer
113 views

I have an abstract "x vs y" question. In C programming language if I have some small amount of data which I want to store somewhere in RAM, I suppose typical options are the next ones: to ...
Eimrine's user avatar
  • 61
0 votes
0 answers
47 views

If I understand correctly, the RAM is virtually divided into stack and heap. Stack takes primitive types/functions etc and Heap deals with the reference types and objects. Stack follows the LIFO ...
Hopen's user avatar
  • 1
0 votes
0 answers
171 views

I am trying to allocate a new stack on the heap in C++ for a function using VirtualAlloc. While debugging, I noticed that the rsp value for my function can either increase or decrease relative to the ...
kliri's user avatar
  • 1
1 vote
0 answers
496 views

I'm trying to build a recruitment management website (nodejs), but when I'm almost done I get this error: Uncaught RangeError: Maximum call stack size exceeded. functionjs.js Here is my functionjs.js ...
Cmint's user avatar
  • 19
1 vote
0 answers
39 views

I'm debugging a program that has many alloca and triggers EXC_BAD_ACCESS (with -msanitize=address) or crashes __chkstk_darwin (without compiler sanitizer). I want to know the valid stack address range ...
jiandingzhe's user avatar
  • 2,185
3 votes
2 answers
120 views

I'm using an array of functions pointers, and I'd like to use it directly with their associated event IDs. Problem is, event IDs start from 0x10 to 0x1C, and from 0x90 to 0xA5. I don't want to write ...
mescande's user avatar
-1 votes
1 answer
311 views

For context, this was taken from an excerpt in a book: Finally, sometimes you can't even use heap memory! If you are programming in Rust for a small embedded device, you are going to have to use only ...
Dainank's user avatar
  • 2,613
0 votes
0 answers
103 views

rephrased the question Getting segmentation fault right after last printf after iterating and displaying stack values (2 iterations for simplicity purposes). Just trying to display hex value on the ...
T-series's user avatar

1
2 3 4 5
22