fix a regression introduced by Refactor handling of non-SOH generations (#1688)
authorMaoni Stephens <Maoni0@users.noreply.github.com>
Mon, 4 May 2020 23:05:20 +0000 (16:05 -0700)
committerGitHub <noreply@github.com>
Mon, 4 May 2020 23:05:20 +0000 (16:05 -0700)
this is supposed to get the user allocations, before #1688 it was getting gen0 and gen3. with the refactor it should get gen0 and all UOH allocations.

src/coreclr/src/gc/gc.cpp

index 6c5c1d7..a91de0d 100644 (file)
@@ -15020,11 +15020,12 @@ size_t gc_heap::get_total_allocated_since_last_gc()
 // Gets what's allocated on both SOH, LOH, etc that hasn't been collected.
 size_t gc_heap::get_current_allocated()
 {
-    size_t current_alloc = 0;
-    for (int i = max_generation; i < total_generation_count; i++)
+    dynamic_data* dd = dynamic_data_of (0);
+    size_t current_alloc = dd_desired_allocation (dd) - dd_new_allocation (dd);
+    for (int i = uoh_start_generation; i < total_generation_count; i++)
     {
         dynamic_data* dd = dynamic_data_of (i);
-        current_alloc = dd_desired_allocation (dd) - dd_new_allocation (dd);
+        current_alloc += dd_desired_allocation (dd) - dd_new_allocation (dd);
     }
     return current_alloc;
 }