Red Hat :: Find The Dynamic Stack And Heap Size Of A Running Process In Rhel?

Aug 26, 2010

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?

Is there any maximum limit to the heap memory allocation?My program is in PERL and i am using a solaris system. when i did "pmap pid" (pid = my process id) it is showing a number of heap memory allocated and all of them with GB sizes. This single process is eating up most of the physical memory.Is it normal and is there any way to get the heap memory size down

Why the thread stack size can not be changed after calling pthread_attr_setstacksize & pthread_create in a dynamic library? Detail: I write a file thread_factory.c and plan to build it and produce a dynamic library (libthread_factory.so) In the thread_factory.c , there is a routine

[Code]....

And after this, there is application, it will call fct_thread_create(STACK_SIZE_256KB), and then call pthread_attr_getstacksize(), but the stack size return always be a fixed value 0xa01000. (I tried this on Fedora12) But if I build the application source code with the file thread_factory.c directly, the stack size return is right as my expect. I checked the source code of glibc about the routine pthread_create() as below:

Why is it in Linux that there is a stack size set by default? And why is it so small? (My system is set to 8192 kbytes.) And why is there a default limit on the stack size when the max memory and virtual memory size are, by default, unlimited? (Aren't they both fed from the same place ultimately?)

Reason I ask: I want to use recursive functions in my programming a lot more. Problem is, if the language (or implementation) doesn't happen to support tail-call recursion, then I can be pretty well certain that the first huge problem that gets thrown at my function is going to kill my program because the stack size limit is going to be quickly reached. Obviously, I can change the stack size limit for my own computers, but it doesn't feel so great knowing that most of the people who copy and execute my code will have probably have overlooked this. Anyway, does anyone know: is this small default stack size limit just one of those historical artifacts, or is there some technical reason for it?

I am trying to write a script that will look for a plugin and check that its running and if not start it Code:ps ax | grep -v grep | grep aseco.phpThe above should list the process, if I put it into terminal this is incorrect?

I seem to only be able to set my stack size on my linux server to 15000. If I increase it to 20000 I get a Segmentation Fault. how I can get the linux OS to increase the stack size? Code: threadRet |= pthread_attr_setstacksize( &m_ThreadAttributes, 15000 );

Possible Duplicate: Finding the process that is using a certain port in Linux I'm using Ubuntu Linux 11.04. How do I write a shell script expression that will find the process running on port 4444 and then kill the process?

Desperate to reduce RAM usage of my tiny VPS running Ubuntu 9.04 and Apache2.2.11, here I saw that:On Linux, each child process will use 8MB of memory by default. This is probably unnecessary. You can decrease the overall memory used by Apache by setting ThreadStackSize used by Apache by setting ThreadStackSize to 1MB in.

So I tried to give the suggestion a try. But when I append:ThreadStackSize 1000000in my /etc/apache2/httpd.conf <IfModule mpm_prefork_module> directive, and restarted apache, it failed with this message:Invalid command 'ThreadStackSize', perhaps misspelled or defined by a module not included in the server configuration

So I figured out that the relevant modules are neither enabled nor available on apache2. Now I am wondering whether there is a way to decrease the ThreadStackSize without the need to compile apache from source? If not, what should I do?

I am currently struggling with one of my tasks.I was asked to find a way how to determine how much time an _already running_ process is spending in user and kernel space.E.G. <some tool> <pid>[Control] + [c]<pid> spent 12.1 seconds in user and 1.52 seconds in kernel space.Does something like this exist? Basically I guess I am looking for something similar to time, except that the process is already running.So..a) Is there a tool which fulfills this task?b) Is there a way to write your own software which does the job? Is it even possible to code something I am looking for?I recently found strace -c -p <pid>, but well, this is not exactly what I was looking for.

Code: STACK size: 98222 [0x7f665dbe4e00 0x7f665db25090] and i'm not quite sure what they mean, so far it looks it's related to the shell stack limit set by ulimit, however i've tried to change it (increasing it) however this message still persists.

i have an application that launches several pthreads, i know that the default size used by Linux is 8Mb for each pthread. However i would like to optimize the total memory usage by my application by decreasing the default stack size of each pthread to the needed resources. My questions:

- Are there any rules to set the pthread stack size.- How to compute the memory needed by each thread.- Is the malloc call inside a thread counted from the stack size of the same pthread?

I mistakenly ran 'iptables restart' on a server that was not set to run iptables. Immediately, the server quit making outgoing connections on port 80. It has problems completing a traceroute when another machine on the same VM Host can do everything just fine. One of our best networking technicians diagnosed it as issues with the TCP/IP stack on the OS.

(In fact, it fails to load ALL of the dynamic php modules, either with the "undefined symbol: executor_global" or "undefined symbol: core_globals" I DO NOT WANT to compile anything -- I want to stay with stock RedHat released software.

I would have presumed that you have 2 x agregates giving 2 x 2gig links and the resilience is that if one nic fails in either bond you carry on with that bond running a 1 gig link until fixed. But, our architect wants to have an active/passive (mode 1) accross bond2 and bond3. I have setup tons of mode 1 bonds and mode 4 bonds but never tried bonding 2 x mode 4 bonds!

Sometimes I connect to my Debian box from another computer (using SSH on Cygwin or Linux), and once ina while I want to run some console apps. And sometimes some of these apps might complain about "another intance, Error: an instance of newsbeuter is already running (PID: 2496)". Is there a work around for this issue at all(without killing the original instance") ? The reason I do not want to kill the app because there might be 2 users connected to the same machine that might be using the same app.

I want to restrict the Visitors to my Webserver whom i want to give access But the persons whom i want to give access. have Dynamic IP. I want to use DynDNS and update IP address of person. Based on the Hostname Pointing to Dynamic address of person.

I have a Canoscan LiDE 30 scanner which works fine in Linux. I haven't used it in months, and never since moving from Jaunty x86_64 to Fedora 11 x86_64. This evening I suddenly need to scan two pages to send to someone via e-mail, and the recipient is desperate to receive them. Naturally, Xsane has decided this is the moment to screw me.

The problem: I cannot figure out how to tell Xsane that the page size is 8.5 11. It insists on scanning only the left side, 3.99 x 11. I cannot find a page size anywhere in any of the buttons.

In Preview I once got it to scan the entire page, but could not figure out how to save the image to file. Subsequently I have not been able to figure out how I did it. In any event, scanning from the small main window always scans 3.99 x 11. Adjusting the scan area manually in the Preview window allows me to change the size area in the small main window to 8.5 x 11, but when I then scan from the small main window it reverts to 3.99 x 11.

I have scanned the document a hundred times at least, each time trying different buttons, but nothing has succeeded in getting the full page.

I need to know, what process for what purpose is using memory in my machine. ps utility with various options seems to give not exactly what i want, i.e. if i sum all the values like RSS, VSZ or some other values related to memory usage, the sum is not equal (even approximately) to what i get using free|grep "buffers/cache".How can i get this information? Even better, i would like to see contribution of every process, ramdisk, etc. to memory usage.

How to assign CPU and memory resource to a certain process? How to assign CPU and memory resource to a certain user?Let's assume the software is no limit for resource usage.Below is a description of my situation.dual 6 core, 32G memory, RHEL5.5 client with workstation option.I run a big computation (say process1). However, I found from KDE system guard the CPU and memory are not loaded as expected. below are numbers. user% system%process1 100 0.00and CPU idle 90%, memory free 97%

I have a startup script placed in /etc/init.d wherein I make the following call:

nohup sudo -u myuser $CATALINA_HOME/bin/startup.sh 2>&1

This causes Tomcat to be run as myuser, which is expected. However after issuing the reboot command the system starts up and root is now the owner of this process. How can I force the process to be started off as myuser on reboot?

I'm searching for an algorithm to sort a binary min heap tree. That's when in root i have the smallest value in the tree. The only restriction it has, is that the parent must be smaller the its two children. i think something like quick-sort, but i don't know how to implement it.

The aim of this script is, when the folder reaches 20M then attributes will be set to that particular folder so that no newfiles and folders cannot be created or copied to that samplefolder. whenever i copy a file morethan 20M to that folder its getting copied fully and then the attributes were applied. But i dont want this to happen, when the folder reaches its maximum current write operation to that folder should be stopped automatically with a error.