summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaoni Stephens <Maoni0@users.noreply.github.com>2017-03-16 17:57:49 -0700
committerGitHub <noreply@github.com>2017-03-16 17:57:49 -0700
commit8bc067c194f0b44e95c6e6a490b99078a2fa9719 (patch)
treef7c867e6dc5f74297fdbf47f3a7e19033463f75c
parent0c3d8c7fa54bd77ef2df23b8364812affe8deb10 (diff)
downloadcoreclr-8bc067c194f0b44e95c6e6a490b99078a2fa9719.tar.gz
coreclr-8bc067c194f0b44e95c6e6a490b99078a2fa9719.tar.bz2
coreclr-8bc067c194f0b44e95c6e6a490b99078a2fa9719.zip
need to account for the allocated bytes correctly for the following: (#10162)
need to account for the allocated bytes accurately for the following cases
-rw-r--r--src/gc/gc.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/gc/gc.cpp b/src/gc/gc.cpp
index b4c0475832..9551e9fad4 100644
--- a/src/gc/gc.cpp
+++ b/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);