Skip to content

Commit

Permalink
[mono] Fix stack size detection of main thread on alpine
Browse files Browse the repository at this point in the history
  • Loading branch information
BrzVlad committed Oct 20, 2022
1 parent fe921e0 commit 08735ad
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/mono/mono/metadata/domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ create_root_domain (void)
return domain;
}

static MONO_NO_OPTIMIZATION MONO_NEVER_INLINE void
ensure_stack_size (void)
{
const int default_size = 1024 * 1024;
volatile uint8_t *s = (uint8_t *)g_alloca(default_size);
*s = 0;
}

/**
* mono_init_internal:
*
Expand Down Expand Up @@ -128,6 +136,8 @@ mono_init_internal (const char *root_domain_name)

mono_counters_register ("Max HashTable Chain Length", MONO_COUNTER_INT|MONO_COUNTER_METADATA, &mono_g_hash_table_max_chain_length);

ensure_stack_size ();

mono_gc_base_init ();
mono_thread_info_attach ();

Expand Down

0 comments on commit 08735ad

Please sign in to comment.