Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [stack]

The tag has no usage guidance.

7
votes
2answers
111 views

How does the ELF loader determine the initial stack size?

I'm studying the ELF specification (http://www.skyfree.org/linux/references/ELF_Format.pdf), and one point that is not clear to me about the program loading process is how the stack is initialized, ...
0
votes
0answers
19 views

When to “Comment”, and when to “Answer”? [migrated]

I am trying to contribute effectively to the community but I am not clear on when to Comment and when to Answer a question? I see many 'answers' in comments and I am not sure why they chose not to ...
0
votes
1answer
37 views

AIX process stack watermark

Does exist any tool/command for checking the maximum that a process stack has used? I need that to tune the stack size configuration for a program.
1
vote
1answer
207 views

How does Linux Kernel switches from kernel stack to interrupt stack?

What happens when a user mode task is interrupted ? I know for a fact that the CPU switches to the kernel mode stack by refring the TSS. But when and how does the kernel switches to the IRQ stack?
8
votes
2answers
3k views

Why on modern Linux, the default stack size is so huge - 8MB (even 10 on some distributions)

For example, on OSX, it's even less than 512k. Is there any recommended size, having in mind, that the app does not use recursion and does not allocate a lot of stack variables? I know the question ...
9
votes
2answers
1k views

What sets fs:[0x28] (stack canary)?

From this post it is shown that FS:[0x28] is a stack-canary. I'm generating that same code using GCC on this function, void foo () { char a[500] = {}; printf("%s", a); } Specifically, I'm ...
1
vote
1answer
648 views

pstack not printing stack output [closed]

I am running pstack to find function stack for my application running on two machines (both RHEL) In one of my machine it is working as expected [root@civ4cez191 bin]# pstack 22947 Thread 2 (Thread ...
1
vote
0answers
40 views

How can I find the deepest and most stack-hungry call chains in a program?

I have a program written in OCaml that tends to stack-overflow on platforms with small stacks. Rather than ulimiting the program to find and solve stack overflows one by one, I'd like to get a sorted ...
1
vote
1answer
2k views

GDB command to print the address of starting of buffer (stack)

For gdb debugger (gdb) p &buffer This command is used to print the content of starting of buffer (stack), or print the address? If it is content, how to print the address?
-1
votes
2answers
396 views

fork() and execve() efficiency [closed]

In terms of memory allocation efficiency is it right to say that after a fork() in the code of the child if I execute a program with execve() this would be more efficient than the same program ...
2
votes
1answer
2k views

program stack size

I learned default stack size for each process is limited to 8MB and mmap_base is calculated based on stack size in rlimit and random value. Code below is mmap_base function which calculates mmap_base ...
0
votes
1answer
430 views

Top: DATA = RES + stack + what?

I've analyzed memory consumption of a java program on Linux Mint. I used top to capture memory statistics (memory used by program and also system-wide indicators like total_mem_used and mem_free). The ...
1
vote
1answer
91 views

Could the stack be swapped to disk on Linux and can it be prevented

On Linux, is it possible that memory pages that contain the process stack get swapped to disk? If so, is there a way to prevent that, either at compile time or at runtime. I'm asking because of a ...
3
votes
2answers
481 views

Memory Randomization in Linux

I created a simple C program and every time I load it in GDB, I see the same memory addresses allocated to the instructions of the program. For example, a function what() always loads at memory ...
1
vote
1answer
347 views

What is the relationship between the stack and the process table?

According to Wikipedia and many other sources, Since PCB contains the critical information for the process, it must be kept in an area of memory protected from normal user access. In some ...
2
votes
1answer
352 views

Why must the stack VMA be executable?

I am currently reading Linux Kernel Development by Robert Love. In the chapter "15 The Process Address Space" he prints the memory map of a process. user@machine:~$ pmap 1424 #all the processes ...
1
vote
1answer
62 views

Can you translate stack data? What is the data? [closed]

What I want to know is how is the data in a stack translated. We can see the data like: 0x80808080 but does it have a meaning? What parts of the numbers stand for something different? And what does '...
1
vote
1answer
64 views

bash - isolating uppercase words

So, I have a directory containing around 50 directories having for name 3 letter uppercase words: AXC BCC EFC amongst other directories. I have already done a find to seek these 3 letter directories ...
2
votes
2answers
653 views

Main stacks in Linux

What are the main stacks in Linux? What I mean is, for example when an interrupt occurs what stack will be used for it, and what is the difference between user process and kernel process stacks?
0
votes
1answer
59 views

Match the three columns in 2 annotation files and print those lines to a new output file

I have 2 files, file 1 and file 2 with the same column numbers. Column one has the chromosome number, column two has the promoter start site and column three has the promoter stop site. I want to ...
-1
votes
2answers
93 views

First match if we are on the first line of input, if so print the whole line, else print the first word followed by a comma

for eg: CREATE TABLE MWWDATA.ACK997 ( AKTYPE CHAR(2) DEFAULT '' NOT NULL , AKNUM CHAR(9) DEFAULT '' NOT NULL ); CREATE TABLE MWWDATA.APREIDEXC ( EMPLID NUMBER(15, 0) DEFAULT NULL ); I ...
0
votes
3answers
47 views

i want to print the line which starts with a paricular word and in the rest records print only 1st field

for eg: CREATE TABLE MWWDATA."VTCat02" ( "ID" NUMBER(10) DEFAULT NULL , "Cat" VARCHAR2(255) DEFAULT NULL , "Style_Code" VARCHAR2(255) DEFAULT NULL , "Vendor_Style_#" VARCHAR2(255) ...
0
votes
1answer
539 views

I want to delete from particular words in all the line if that particular word is present

eg: CREATE VIEW AIPKEYITEM.SEASONGROUPNETSALES ( CALENDARID , PRODUCTGROUPID FOR COLUMN PRDGRPID , NETSALESDOLLARS FOR COLUMN NETSA00001 , NETSALESUNITS FOR COLUMN NETSA00002 ) AS SELECT ...
11
votes
1answer
14k views

How can I monitor per process/per thread memory consumption (divided into heap, stack, data, code)?

Before jumping in and writing my own code, I want to find out if there is GNU/Linux software that is able to output something similar to QNX's showmem. For each thread of each process that is running,...
17
votes
3answers
15k views

How does stack allocation work in Linux?

Does the OS reserve the fixed amount of valid virtual space for stack or something else? Am I able to produce a stack overflow just by using big local variables? I've wrote a small C program to test ...
2
votes
1answer
3k views

Ulimit unlimited stack behavior oddity

I am running an application on a Solaris 10 system. Yesterday we have set the process stack size to unlimited: ulimit -s unlimited Today during the load the process would not come up reporting that ...