finding stack size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi  all ,

Is there any way or tool in which i can find the maximum stack size used by a process while executing.

i also do malloc in the process, which will come from heap.

In other words i need to find out, what wud be the maximum size of stack segment taken by my process.

And if i use threads
pthread_attr_getstacksize (attr, stacksize) cud help me
but the default stack size is PTHREAD_STACK_MIN, *12 defined in pthread.h and 
without knowing how much of the stack wud be used, i can n't use pthread_attr_setstacksize (attr, stacksize). 

and this is what i finally want to do.

I remember once i was working on Tornado tool (VxWorks) there we cud get graphical represenation of how much stack is used,
I am not aware, if we have something like that or command line or some smart way to find that in Linux.

I tried to get some information from gdb 

-f option (-stack-info-frame) but cud not get much of it.

Stack level 0, frame at 0xbffff930:
 eip = 0x8048526 in main (threads1.c:9); saved eip 0x40057177
 source language c.
 Arglist at 0xbffff928, args:
 Locals at 0xbffff928, Previous frame's sp is 0xbffff930
 Saved registers:
  ebp at 0xbffff928, eip at 0xbffff92c
Command execution time: 0.000000
Space used: 2760704 (+0 for this command)
 
  
Stack level 0, frame at 0xbffff930:
 eip = 0x8048567 in main (threads1.c:16); saved eip 0x40057177
 source language c.
 Arglist at 0xbffff928, args:
 Locals at 0xbffff928, Previous frame's sp is 0xbffff930
 Saved registers:
  ebp at 0xbffff928, eip at 0xbffff92c
Command execution time: 0.000000
Space used: 3289088 (+0 for this command)

I hope i have explained clearly what i am looking for, plz correct me if i am wrong.
And if i have made it ambiguous, feel free to question me.


regards,
Vishal.

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux