[Mono-dev] Define stack size during compilation. (Anatoly Tolstobrov)
Evgeny Pirogov
pirogov.e at gmail.com
Thu Apr 19 11:54:06 UTC 2018
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dot.net/pipermail/mono-devel-list/attachments/20180419/3c3c6954/attachment.html>
More information about the Mono-devel-list
mailing list