LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 01-29-2008, 01:39 PM   #1
ebinjose
LQ Newbie
 
Registered: Jan 2008
Posts: 14

Rep: Reputation: 0
How to calculate the StackSize Required


Hi Friends,

I need to set the stack size for a thread (by invoking "pthread_attr_setstacksize", but my question is not about this function as such, but how to fix the Stack Size in general). I have been using this for a while. But all the time I had been giving few KBs. And if the program crashes with some memory corruption, I increase the stack size and test. But I feel this is not an effective way of doing.

Is there a way to effectively calculate the stack size thats required for a thread (created using "pthread_create").

Thanks in advance.

./Ebin.
 
Old 02-03-2008, 01:47 PM   #2
traene
Member
 
Registered: Jan 2005
Distribution: Archlinux, Debian, Centos
Posts: 222

Rep: Reputation: 35
I guess it depeds on what your process is doing. Each method call uses a few bytes, (ie, arguments passed to the function, return address and so on), temporary variables are created on the stack, etc.

Maybe a tool like valgrind can help. You may check cachegrind. (it's included in valgrind)
 
  


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
appropriate value for stacksize? johnpaulodonnell Linux - Newbie 2 04-27-2007 10:26 AM
ndiswrapper on Fedora 3 (and 4k stacksize) unzari Linux - Wireless Networking 4 04-25-2005 07:16 AM
rebuild kernel with a stacksize of 8k? Peanutman Fedora 6 03-28-2005 02:20 PM
how do i increase user stacksize? zepplin611 Linux - Newbie 2 08-20-2004 11:28 PM
how to increase stacksize? pthreads and stacksize, winex3 deNiro Slackware 4 11-03-2003 02:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 12:54 PM.

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