-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Labels
Milestone
Description
This happens when running this program:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Reflection;
using System.Diagnostics;
namespace CoreLab
{
internal sealed class Finalizer
{
private char[] data;
private static Finalizer resururector;
private static int MAX = 10000;
private int index;
public Finalizer(int i)
{
index = i;
data = new char[i];
}
~Finalizer()
{
// For every 10 objects, resurect 1 object
// this is cover the resurecting scenario of finalizer objects.
if(index % 10 == 0)
{
resururector = this;
}
}
public static void Main()
{
for(int i = 0; i < MAX; ++i)
{
new Finalizer(i * 16);
GC.Collect();
GC.WaitForPendingFinalizers();
}
}
}
}with set DOTNET_gcServer=1, set DOTNET_GCDynamicAdaptationMode=1 and // #define STRESS_DYNAMIC_HEAP_COUNT uncommented in gcpriv.h.
Why this happen is unclear yet, but STRESS_DYNAMIC_HEAP_COUNT doesn't do anything except with messing around with some measurement variables, it is perceivable that this could manifest as a real bug in the product under certain situations.