From: Maoni Stephens Date: Fri, 17 Mar 2017 00:57:49 +0000 (-0700) Subject: need to account for the allocated bytes correctly for the following: (dotnet/coreclr... X-Git-Tag: submit/tizen/20210909.063632~11030^2~7688 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9a07930424faf75c5c7b0b6699ef05ee873e0054;p=platform%2Fupstream%2Fdotnet%2Fruntime.git need to account for the allocated bytes correctly for the following: (dotnet/coreclr#10162) need to account for the allocated bytes accurately for the following cases Commit migrated from https://github.com/dotnet/coreclr/commit/8bc067c194f0b44e95c6e6a490b99078a2fa9719 --- diff --git a/src/coreclr/src/gc/gc.cpp b/src/coreclr/src/gc/gc.cpp index b4c0475..9551e9f 100644 --- a/src/coreclr/src/gc/gc.cpp +++ b/src/coreclr/src/gc/gc.cpp @@ -5800,9 +5800,10 @@ void gc_heap::fix_allocation_context (alloc_context* acontext, BOOL for_gc_p, alloc_contexts_used ++; } - if (for_gc_p) { + // We need to update the alloc_bytes to reflect the portion that we have not used + acontext->alloc_bytes -= (acontext->alloc_limit - acontext->alloc_ptr); acontext->alloc_ptr = 0; acontext->alloc_limit = acontext->alloc_ptr; } @@ -11375,6 +11376,13 @@ void gc_heap::adjust_limit_clr (uint8_t* start, size_t limit_size, } acontext->alloc_ptr = start; } + else + { + // If the next alloc context is right up against the current one it means we are absorbing the min + // object, so need to account for that. + acontext->alloc_bytes += (start - acontext->alloc_limit); + } + acontext->alloc_limit = (start + limit_size - aligned_min_obj_size); acontext->alloc_bytes += limit_size - ((gen_number < max_generation + 1) ? aligned_min_obj_size : 0);