Wireshark-dev: Re: [Wireshark-dev] Static analysis added to the buildbot

From: Guy Harris <guy@xxxxxxxxxxxx>
Date: Wed, 16 Feb 2011 20:42:32 -0800
What's the default process stack size in Win32?

The MSVC++ static analyzer is giving some

	c:\buildbot\...\blahblahblah.c(XXX) : warning C6262: Function uses 'YYY' bytes of stack: exceeds /analyze:stacksize'16384'. Consider moving some data to heap

but we're just running the static analyzer with /analyze:WX-, and YYY is typically < 128K in those messages.  Is the default stack size really 16K, in which case we should either

	1) consider moving some data to heap

or

	2) crank up the stack size when we build - I think the stack size can be set at link time for Windows

or is it just that the static analyzer is, by default, testing against a small stack, in which case we should perhaps crank the stack size up?  The limit for the main thread of a process is normally set by the kernel in UN*X, and it's 8MB in OS X, at least for 64-bit binaries:

	$ ulimit -a

		...

	stack size (kbytes)            (-s)  8192

(i.e., 8192 kbytes, or 8 mbytes) - I don't know of any UN*Xes that let you set it in, say, the linker.  (For other threads, it's set by, for example, the attributes you pass to pthread_create(), but that's another matter.)