Stack Memory


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Stack Memory
# 1  
Old 06-23-2011
Question Stack Memory

I have a java process that piles up the stack memory.

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

The max stack memory is highlighted in bold.

But i need to know what is the current HEAP memory used by my java process PID.

Regards,
Mohtashim

Last edited by pludi; 06-23-2011 at 05:40 PM..
# 2  
Old 06-23-2011
What system are you using?
# 3  
Old 06-23-2011
That's your data segment. It's set to 'unlimited'.
# 4  
Old 06-23-2011
Thats my OS
SunOS mypc 5.10 Generic_144488-07 sun4v sparc SUNW,SPARC-Enterprise-T5220

With my java code it throws an error as it breaches stack size (kbytes, -s) 8192 of stack memory ater 12-15 mins time.

I wish to monitor the current stack memory used by my PID (java program) so that i can alert before it breaches the limit which is 8192K.

Kindly help.
# 5  
Old 06-23-2011
Check:
Code:
pmap PID

# 6  
Old 06-24-2011
Hey thanks a ton for you directed me to the right place. PMAP helps.
But i need a little more push to get going Smilie.

Based on tests i believe that the stack memory is shared amoung processes.

so if there are 4 instances of the same process running parellely and the total stack memory of the OS is approx 8000k, each process will get 2000k before running out of stack. True pmap helps the current stack memory consumption for that PID, but if I wish to alert before the stack runs out of memory for that PID, I need to know what is the current free stack memory left on the operating system. Can you help me the know how to achieve this alert mechanism?

PID=2756
Output:
Code:
 
pmap 2756 | grep stack
B13CE000       8K rw--R    [ stack tid=34 ]
B157E000       8K rw--R    [ stack tid=35 ]
B167C000      16K rw--R    [ stack tid=33 ]
B177C000      16K rw--R    [ stack tid=32 ]
B1FCE000       8K rw--R    [ stack tid=30 ]
B27C8000      32K rw--R    [ stack tid=29 ]
B2FC8000      32K rw--R    [ stack tid=28 ]
B307E000       8K rw--R    [ stack tid=31 ]
B317E000       8K rw--R    [ stack tid=27 ]
B327E000       8K rw--R    [ stack tid=26 ]
B337E000       8K rw--R    [ stack tid=25 ]
B347E000       8K rw--R    [ stack tid=24 ]
B357E000       8K rw--R    [ stack tid=23 ]
B367E000       8K rw--R    [ stack tid=22 ]
B377E000       8K rw--R    [ stack tid=21 ]
B387E000       8K rw--R    [ stack tid=20 ]
B397E000       8K rw--R    [ stack tid=19 ]
B3A7E000       8K rw--R    [ stack tid=18 ]
B3B7E000       8K rw--R    [ stack tid=17 ]
B3C7E000       8K rw--R    [ stack tid=16 ]
B3D7E000       8K rw--R    [ stack tid=15 ]
B3E7E000       8K rw--R    [ stack tid=14 ]
B3F7E000       8K rw--R    [ stack tid=13 ]
B407E000       8K rw--R    [ stack tid=12 ]
B417E000       8K rw--R    [ stack tid=11 ]
B427E000       8K rw--R    [ stack tid=10 ]
B437E000       8K rw--R    [ stack tid=9 ]
F897E000       8K rw--R    [ stack tid=8 ]
F8A7E000       8K rw--R    [ stack tid=7 ]
F8B7E000       8K rw--R    [ stack tid=6 ]
FAD7E000       8K rw--R    [ stack tid=5 ]
FAE7E000       8K rw--R    [ stack tid=4 ]
FAF7E000       8K rw--R    [ stack tid=3 ]
FB8FE000       8K rw--R    [ stack tid=2 ]
FF7D4000     176K rw---    [ stack ]
FF800000    4096K rw---    [ stack ]

pmap 2756 | grep stack | awk '{print $2}'
Code:
8K
8K
16K
16K
8K
32K
32K
8K
8K
8K
8K
8K
8K
8K
8K
8K
8K
8K
8K
8K
8K
8K
8K
8K
8K
8K
8K
8K
8K
8K
8K
8K
8K
8K
1536K

Also wanted to know if I need to total this or the last value is the total stack meory consumption for that PID.

Last edited by Scott; 06-24-2011 at 04:06 PM.. Reason: Code tags
# 7  
Old 06-24-2011
I'm pretty sure ulimit is controlling sizes of different structures for each process separately, not whole system. As for your output, I guess adding those values would be correct Smilie
 
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