Hello, Anatoly

I think an idea to change stack size will be reused from .net windows world
as well.
It simple to change maxstacksize for a thread and stay with defaults on
main thread I think.

An example from stackowerflow :

public Thread (ThreadStart start, int maxStackSize)
{
    if (start == null)
        throw new ArgumentNullException ("start");

    threadstart = start;
    Internal.stack_size = CheckStackSize (maxStackSize);
}

static int CheckStackSize (int maxStackSize)
{
    if (maxStackSize < 0)
        throw new ArgumentOutOfRangeException ("less than zero",
"maxStackSize");

    if (maxStackSize < 131072) // make sure stack is at least 128k big
        return 131072;

    int page_size = Environment.GetPageSize ();

    if ((maxStackSize % page_size) != 0) // round up to a divisible of page
size
        maxStackSize = (maxStackSize / (page_size - 1)) * page_size;

    int default_stack_size = (IntPtr.Size / 4) * 1024 * 1024; // from
wthreads.c
    if (maxStackSize > default_stack_size)
        return default_stack_size;

    return maxStackSize;
}

https://stackoverflow.com/questions/19817790/stack-size-under-mono?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa

Thank you
Yevhen
_______________________________________________
Mono-devel-list mailing list
Mono-devel-list@lists.dot.net
http://lists.dot.net/mailman/listinfo/mono-devel-list

Reply via email to