Thus spake Ferruccio Vitale <[EMAIL PROTECTED]>:
> I'm writing a little multithread program: in my thread function, I allocated a char 
> variable of IP_MAXPACKET size; when I try to compile it, everything goes well, but 
> when I run it, it dies, making a core file. 
> Assume that:
> 1) the same code, with only one thread, linked to libc, runs normally
> 2) the same code, with a smaller variable size, linked to libc_r, runs normally
> 3) I tried to allocate two variables of 64000 bytes in this function (IP_MAXPACKET 
> is equal to 65535), linked to libc_r and runs normally
> 
> Where am I wrong? :))

Threads get much smaller stacks by default than monolithic
processes.  You should avoid making large allocations on the stack
in order to avoid this problem.  Use malloc()/free() instead.
(You can kludge around the problem by using larger stack sizes,
but you really shouldn't.)

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to