B
Barry Anderberg
To see the bug for yourself, create a new C# Windows Forms
application.
Put a call to this function in your Form constructor:
private void OverflowLargeObjectHeap()
{
int[] largeArray;
largeArray = new int[1000000];
for (int i=0;i<=100;i++)
{
GC.Collect();
// previous reference is lost so int array should be garbage
collected - but it isn't!
largeArray = new int[largeArray.Length + 100000];
}
}
Run the program, and watch what happens. The garbage collector isn't
properly cleaning up these objects from the large object heap after
their reference count goes to zero!
That's a BIG BUG!
application.
Put a call to this function in your Form constructor:
private void OverflowLargeObjectHeap()
{
int[] largeArray;
largeArray = new int[1000000];
for (int i=0;i<=100;i++)
{
GC.Collect();
// previous reference is lost so int array should be garbage
collected - but it isn't!
largeArray = new int[largeArray.Length + 100000];
}
}
Run the program, and watch what happens. The garbage collector isn't
properly cleaning up these objects from the large object heap after
their reference count goes to zero!
That's a BIG BUG!