Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/coreclr/vm/corhost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -608,12 +608,6 @@ HRESULT CorHost2::CreateAppDomainWithManager(
pwzAppPaths = pPropertyValues[i];
}
else
if (u16_strcmp(pPropertyNames[i], W("DEFAULT_STACK_SIZE")) == 0)
{
extern void ParseDefaultStackSize(LPCWSTR value);
ParseDefaultStackSize(pPropertyValues[i]);
}
else
if (u16_strcmp(pPropertyNames[i], W("USE_ENTRYPOINT_FILTER")) == 0)
{
extern void ParseUseEntryPointFilter(LPCWSTR value);
Expand Down
28 changes: 1 addition & 27 deletions src/coreclr/vm/threads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2052,38 +2052,12 @@ HANDLE Thread::CreateUtilityThread(Thread::StackSizeBucket stackSizeBucket, LPTH
return hThread;
}

// Represent the value of DEFAULT_STACK_SIZE as passed in the property bag to the host during construction
static unsigned long s_defaultStackSizeProperty = 0;

void ParseDefaultStackSize(LPCWSTR valueStr)
{
if (valueStr)
{
LPWSTR end;
errno = 0;
unsigned long value = u16_strtoul(valueStr, &end, 16); // Base 16 without a prefix

if ((errno == ERANGE) // Parsed value doesn't fit in an unsigned long
|| (valueStr == end) // No characters parsed
|| (end == nullptr) // Unexpected condition (should never happen)
|| (end[0] != 0)) // Unprocessed terminal characters
{
ThrowHR(E_INVALIDARG);
}
else
{
s_defaultStackSizeProperty = value;
}
}
}

SIZE_T GetDefaultStackSizeSetting()
{
static DWORD s_defaultStackSizeEnv = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_Thread_DefaultStackSize);
static DWORD s_defaultStackSizeProp = Configuration::GetKnobDWORDValue(W("System.Threading.DefaultStackSize"), 0);

uint64_t value = s_defaultStackSizeEnv ? s_defaultStackSizeEnv
: (s_defaultStackSizeProperty ? s_defaultStackSizeProperty : s_defaultStackSizeProp);
uint64_t value = s_defaultStackSizeEnv ? s_defaultStackSizeEnv : s_defaultStackSizeProp;

SIZE_T minStack = 0x10000; // 64K - Somewhat arbitrary minimum thread stack size
SIZE_T maxStack = 0x80000000; // 2G - Somewhat arbitrary maximum thread stack size
Expand Down
Loading