LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 08-26-2010, 11:47 PM   #1
marifran
LQ Newbie
 
Registered: Jul 2009
Posts: 8
Blog Entries: 1

Rep: Reputation: 0
Find the dynamic stack and heap size of a running process in rhel


I am trying to find the dyanmic heap size and stack size of a running process in rhel5.5 and rhel6.I read that the 23rd parameter in the file /proc/pid/stat gives the heap size.Can you elaborate more on this.Also is there any other way to do this??
 
Old 08-28-2010, 12:26 AM   #2
DrLove73
Senior Member
 
Registered: Sep 2009
Location: Srbobran, Serbia
Distribution: CentOS 5.5 i386 & x86_64
Posts: 1,118
Blog Entries: 1

Rep: Reputation: 129Reputation: 129
Code:
heap=$(awk '{print $23}' /proc/3045/stat) ; echo $heap
Change actual number of proces, most likely you will check it with bash. And make sure I havent mist the number ($23), maybe it is $22.
 
Old 08-29-2010, 11:55 PM   #3
marifran
LQ Newbie
 
Registered: Jul 2009
Posts: 8

Original Poster
Blog Entries: 1

Rep: Reputation: 0
Yes but how do i verify that the 23rd parameter is the heap size?There is no documentation available from redhat and also the man page says it is vmsize..does this mean it is the virtual memory size??how do i calculate the heap size from the number of pages used by a process?
 
Old 08-30-2010, 06:51 AM   #4
DrLove73
Senior Member
 
Registered: Sep 2009
Location: Srbobran, Serbia
Distribution: CentOS 5.5 i386 & x86_64
Posts: 1,118
Blog Entries: 1

Rep: Reputation: 129Reputation: 129
Then either ask Red Hat support or install kernel sources and look at /usr/src/linux/fs/proc/array.c file for answers.


You can also use codes from "man proc" about stats to format data in "ps" command, like:

Code:
ps axo stat,euid,ruid,tty,tpgid,sess,pgrp,ppid,pid,pcpu,comm | grep <PID number>
Choose what you like to see and awk from that.

Or mix and match and find what you need (field number) with ps command and then use my code from previous post.

Last edited by DrLove73; 08-30-2010 at 07:02 AM.
 
1 members found this post helpful.
Old 08-31-2010, 12:01 AM   #5
marifran
LQ Newbie
 
Registered: Jul 2009
Posts: 8

Original Poster
Blog Entries: 1

Rep: Reputation: 0
thanks a lot!please let me know if you find some documentation or some other way.
what about the stack size?
 
Old 08-31-2010, 02:15 AM   #6
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Quote:
Originally Posted by marifran View Post
I read that the 23rd parameter in the file /proc/pid/stat gives the heap size.
Show us a reference for this assertion.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the maximum allocatable heap size for a process? jaewlee Ubuntu 7 04-02-2010 09:53 PM
dynamic mem allocation, how to change heap size? parv Programming 8 01-19-2008 11:51 PM
get the heap size from a specific process in linux powah Linux - General 3 01-04-2008 05:16 PM
Find out heap size for a PID luexiong Linux - General 1 03-29-2005 09:40 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 08:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration