Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Problems spawning threads
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Edgar Friendly <thelema314@g...>
Subject: Re: [Caml-list] Re: Problems spawning threads
Zheng Li wrote:
> Hi
> Edgar Friendly <> writes:
>> My laptop does a just fine job making and using 503 native threads with
>> 512M ram (and lots of big programs already filling that up).  I don't
>> believe that their (likely beefier) benchmarking system hits a VM limit
>> mine doesn't.
> Just made a test, the upper bound of my machine is 381 threads (without
> event sync, just start threads and hold). You probably have to wrap some
> C function to set pthread's stack size to ~ PTHREAD_STACK_MIN.
Okay, now things get really wierd...  I use a Makefile to build and
execute the test benchmark, and I run make from Emacs using tuareg's C-c
C-c macro.  When I do so, I have no problems running the test - it just
takes a while to complete.  But if I run the same make command from my
bash prompt inside gnome-terminal, I get the "Thread.create: Cannot
allocate memory" error...  hmmm...  Maybe there really is something to
this ulimit deal...

[root@iesyou shootout]# ulimit -s 1000
[root@iesyou shootout]# ./threadring.ocaml_run.opt 10000
[root@iesyou shootout]# ulimit -s 10000
[root@iesyou shootout]# ./threadring.ocaml_run.opt 10000
Fatal error: exception Sys_error("Thread.create: Cannot allocate memory")

I wonder what stack size gets inherited from emacs...  Anyway, this
looks like confirmation of Xavier's theory.  Thanks everyone.