[9fans] thread STACK size

2010-05-19 Thread Mathieu Lonjaret
Hi all, A while ago, while working on btfs, I stumbled upon some sort of overflow (http://9fans.net/archive/2009/07/77) which was in fact due to the thread STACK being too small (and hence if I understood correctly things would get written out of it, in the heap). To be on the safe side, I have

[9fans] thread STACK size

2010-05-19 Thread Sape Mullender
A while ago, while working on btfs, I stumbled upon some sort of overflow (http://9fans.net/archive/2009/07/77) which was in fact due to the thread STACK being too small (and hence if I understood correctly things would get written out of it, in the heap). To be on the safe side, I have it

Re: [9fans] thread STACK size

2010-05-19 Thread Francisco J Ballesteros
I've found it useful to use the testing of the program to also force it to get into what I think is a worst case and then printing the stack size (doing this is simple by printing argument addresses). hth On Wed, May 19, 2010 at 11:55 AM, Federico G. Benavento benave...@gmail.com wrote: also if

Re: [9fans] thread STACK size

2010-05-19 Thread erik quanstrom
As a general rule in threaded programs, avoid declaring local arrays or large structs. Instead, malloc them and free them when you're done. A file server, as an example, should never allocate an 8K message buffer on the stack. If you can manage to obey the rule of not having arrays on the