curl-library
Re: segfault with gzip encoding support
Date: Sun, 28 Dec 2003 14:30:45 -0800
On Wed, Dec 24, 2003 at 12:02:32PM -0800, Vikram wrote:
> > You're using the default stack size in that sample code. It's probably
> > different on FreeBSD vs. Linux, which is why it works on the one but not
> > the other. Try using pthread_attr_setstacksize() to set a large stack
> > (try at least 128 KiB to be safe) for each thread and see if that helps.
>
> You are right. I set the stacksize using pthread_atter_setstacksize to
> (128*1024) and it works.
>
> I further experimented with the stack size. Surprising that 65536
> [64*1024] doesn't work and segfault but anything greater than that works
> [including 65537...]. Why is this?
Not too surprising. 64*1024 is definitely too small; the buffer is
this size, and you still need space for parameters and the call stack.
64*1024+1 probably works because the system likely allocates stack
space in 4096 byte (or larger) chunks, so when you ask for 65537 you
get 69631 bytes (or more) which is may be large enough (barely).
> > Also, make sure you're linking with a thread safe libc.
>
> Yes. I do this; links with libc_r in freebsd.
>>> Dan
-- http://www.MoveAnnouncer.com The web change of address service Let webmasters know that your web site has moved ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=clickReceived on 2003-12-28