Adrian Veith a écrit :
Hello Nicolas,
I found the error. Its in neko_vm_alloc:
vm->c_stack_max = (void*)(((int_val)&vm) - (stack_size - 0x10000));
when allocating a vm and the stack is lower than stack_size, c_stack_max
has an integer overflow. the next call to val_callEx will fail, even if
there is enough stack. On Windows stack_size is assumed to be at last
1MB (which is quite a lot if you have a lot of threads). I suggest, that
stack_size is down sized if there is an overflow in c_stack_size and
that c_stack_size is min 0x10000
now I help myself with a higher default stack for my application.
The idea is to make sure that we have at least 64KB stack free, for the
callstack between startup and first VM call and for the stack needed to
throw the exception in case an overflow occurs. That is indeed quite a
lot but hasn't caused any issue so far. We could indeed reduce it.
What is the allocated stack_size for your threads ?
Best,
Nicolas
--
Neko : One VM to run them all
(http://nekovm.org)