lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Daniel Quintela <dq@soongsoft.com> wrote:

First, this is a great library! I am using it for a few days now and it
works rather well.

Here's a small hint for people who need lots of threads (under Win32):
the number of creatable threads is limited by the stack space they
reserve (not commit!). Available address space is around 2 GB; if each
thread takes up the default of 1 MB that means somewhere around ~1700
threads (there are other overheads to take into account).

To get more threads, use 'link -edit /stack:...' on lua.exe with a value
smaller than 1 MB. (Obviously, a small stack may produce other
problems.)

> It's time to work on 1.6.2 ... :-(

Here are two things. I've compiled for the native Win32 implementation
and found a buglet. Look in syncos.c, line 55:
    return( th == NULL ? -1 : 0);

I think this should be:
    return( *th == NULL ? -1 : 0);

Second, I observe a similar phenomenon as Duck. I've set TASK_SLOTS_STEP
to all sorts of values (I've tried different values between 10 and 512)
and my test scripts sometimes (but alas not always) crash shortly
*after* a realloc has taken place. However, they *never* crash at other
times.

Let's say TASK_SLOTS_STEP==64. Then I see creation of, say, thread 128
or 192 or even 1024. Next, I see a realloc. Then the creation for thread
129 (or 193 or 1025) goes ahead and succeeds. But very shortly
afterwards, the whole thing crashes.

I have inspected the code and found no obvious problem. But something
fishy must be going on here. So for the time being using a big value for
TASK_SLOTS_STEP seems like a good idea;-)

This is Win2K, SP4/rollup.

-- 
cheers  thomasl

web : http://thomaslauer.com/start