Stack Memory


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Stack Memory
# 8  
Old 06-24-2011
Bartus agreed and thanks !!! Is it correct to say everything listed under ulimit -a is for each process seperately?
Code:
ulimit -a
core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
file size (blocks, -f) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 10
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 29995
virtual memory (kbytes, -v) unlimited

Also, can you confirm that the stack for a PID is the sum of the complete pmap output shared above or just the last two lines, becoz for a process not doing much the sum of the stack shows Total used stack memory is:4680

Below is my code:
Code:
stackmem="$(pmap $1 | grep stack | awk '{print $2}'| tr -d ' K')"
n=0
for stack in $stackmem
do
n=`expr $n + $stack`
done
echo "Total used stack memory is:$n"

I guess we may have to discard the stack with the tids [ stack tid=2 ]
while summing the total stack memory used by a PID.

It will be great if you could confirm/comment.

Regards,
Mohtashim

Last edited by Scott; 06-24-2011 at 04:06 PM.. Reason: Code tags
# 9  
Old 06-24-2011
You can't discard stack segments with tid values as they are related to threads running as part of your process and as such are part of the process stack segments. I think you should increase the value in ulimit to allow your process to run with more stack segments. Another option is to redesign your application Smilie
# 10  
Old 06-24-2011
From the getrlimit() man page:

Quote:
Within a multithreaded process, setrlimit() has no impact on the stack size limit for the calling thread if the calling thread is not the main thread. A call to setrlimit() for RLIMIT_STACK impacts only the main thread's stack, and should be made only from the main thread, if at all.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Solaris

[DOUBT] Memory high in idle process on Solaris 10 (Memory Utilization > 90%)

Hi Experts, Our servers running Solaris 10 with SAP Application. The memory utilization always >90%, but the process on SAP is too less even nothing. Why memory utilization on solaris always looks high? I have statement about memory on solaris, is this true: Memory in solaris is used for... (4 Replies)
Discussion started by: edydsuranta
4 Replies

2. Android

32MB USB Memory Stack Not Supported on Android?

Running latest Android for Galaxy Tab 8.9 and bought a 32GB USB flash memory stick for file transfers, etc. Would not work. Searched the net for clues and could not find any. Then, back at the IT store, found out that Galaxy Tab currently only supports up to 16GB for the USD flash memory stick.... (0 Replies)
Discussion started by: Neo
0 Replies

3. UNIX for Dummies Questions & Answers

Kernel Stack vs User Mode Stack

Hi, I am new to the linux kernel development area. I want to know what is the difference between kernel mode stack and user mode stack? Does each process has a user mode stack and a kernel mode stack?? Or Each process has a user mode stack and there is only one kernel mode stack that is shared by... (4 Replies)
Discussion started by: saurabhkoar
4 Replies

4. Programming

How to deal with lots of data in memory in order not to run out of memory

Hi, I'm trying to learn how to manage memory when I have to deal with lots of data. Basically I'm indexing a huge file (5GB, but it can be bigger), by creating tables that holds offset <-> startOfSomeData information. Currently I'm mapping the whole file at once (yep!) but of course the... (1 Reply)
Discussion started by: emitrax
1 Replies

5. Solaris

How to find Total and Free Physical Memory and Logical Memory in SOLARIS 9

Hi, Im working on Solaris 9 on SPARC-32 bit running on an Ultra-80, and I have to find out the following:- 1. Total Physical Memory in the system(total RAM). 2. Available Physical Memory(i.e. RAM Usage) 3. Total (Logical) Memory in the system 4. Available (Logical) Memory. I know... (4 Replies)
Discussion started by: 0ktalmagik
4 Replies

6. Programming

what is stack winding and stack unwinding

helo can u tell me what do you mean by stack winding and stack unwinding Regards, Amit (2 Replies)
Discussion started by: amitpansuria
2 Replies

7. UNIX for Dummies Questions & Answers

memory stack

Hello everbody: when issuing the ulimit -a, on my tru64 machone, I get the following: root@billing4# ulimit -a time(seconds) unlimited file(blocks) unlimited data(kbytes) 10485760 stack(kbytes) 32768 memory(kbytes) 10190528 coredump(blocks) 0... (1 Reply)
Discussion started by: aladdin
1 Replies

8. Programming

memory stack problem

Hi, I am writing a C program under SCO Unix. I have a memory stack problem but do not know how to go about fixing it. I have tried running INSURE but that does not detect any problems. Essentially the problem is that the memory address shifts on return from a routine. I pass a pointer to... (3 Replies)
Discussion started by: jkeagy
3 Replies
Login or Register to Ask a Question