pthread_create fails on a device with 16MB RAM
Alexander Gordeev
lasaine at lvk.cs.msu.su
Tue Feb 1 16:24:54 UTC 2011
В Sat, 29 Jan 2011 16:50:11 -0500
Rich Felker <dalias at aerifal.cx> пишет:
> On Fri, Jan 28, 2011 at 09:31:37AM +0000, Carl Shaw wrote:
> > This occurs because the default maximum stack size is usually 8MB (check
> > using ulimit -s or -a at a shell prompt).
> >
> > You have a number of options to change this:
> >
> [...]
> > 2. Allocate your own stack memory, insert into to a thread attribute
> > structure using pthread_attr_setstack() and use that when creating the
> > thread with pthread_create()
>
> This is the approach application developers should take, since some
> libcs offer ridiculously large stacks (which are reserved/committed on
> systems with overcommit protection!) while others offer tiny ones. A
> portable program that uses nontrivial stack space needs to ensure it
> will be given enough, and a program that doesn't want to waste memory
> should ensure that it's not given too much.
>
> > 3. Patch the C library to use a more appropriate default rather than
> > calling getrlimit(RLIMIT_STACK)!
>
> This sounds like a patch that belongs in uclibc. 32k would be a
> reasonable default.
I was completely satisfied with the following patch:
http://nbd.name/190-nptl_use_arch_default_stack_limit.patch
Maybe it can be accepted in the main tree?
Link to the discussion on openwrt-devel:
https://lists.openwrt.org/pipermail/openwrt-devel/2011-January/009439.html
--
Alexander
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/uclibc/attachments/20110201/7e3beba7/attachment.asc>
More information about the uClibc
mailing list