未验证 提交 ab3663c2 编写于 作者: M Mukund Raghav Sharma 提交者: GitHub

Fix a case of infinite retries while allocating at LOH boundary by constraining retries (#67128)

* Fix a case of infinite retries while allocating at LOH boundary that is now an OOM

* Addressed feedback.

* Updated name of allocation variable and parenthesized the retry check
上级 7c03cb32
......@@ -89,6 +89,8 @@ BOOL bgc_heap_walk_for_etw_p = FALSE;
#define LOH_PIN_QUEUE_LENGTH 100
#define LOH_PIN_DECAY 10
#define UOH_ALLOCATION_RETRY_MAX_COUNT 2
uint32_t yp_spin_count_unit = 0;
size_t loh_size_threshold = LARGE_OBJECT_SIZE;
......@@ -17909,6 +17911,8 @@ BOOL gc_heap::allocate_more_space(alloc_context* acontext, size_t size,
uint32_t flags, int alloc_generation_number)
{
allocation_state status = a_state_start;
int retry_count = 0;
do
{
#ifdef MULTIPLE_HEAPS
......@@ -17923,7 +17927,7 @@ BOOL gc_heap::allocate_more_space(alloc_context* acontext, size_t size,
if (heap_hard_limit && (status == a_state_retry_allocate))
{
alloc_heap = balance_heaps_uoh_hard_limit_retry (acontext, size, alloc_generation_number);
if (alloc_heap == nullptr)
if (alloc_heap == nullptr || (retry_count++ == UOH_ALLOCATION_RETRY_MAX_COUNT))
{
return false;
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册