Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions tests/src/GC/Scenarios/DoublinkList/dlbigleak.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

namespace DoubLink {
using System;
using System.Runtime.CompilerServices;

public class DLBigLeak
{
Expand Down Expand Up @@ -65,13 +66,7 @@ public static int Main(System.String [] Args)

public bool runTest(int iRep, int iObj)
{
Mv_Doub = new DoubLink[iRep];
for(int i=0; i<10; i++)
{
SetLink(iRep, iObj);
MakeLeak(iRep);
GC.Collect();
}
CreateDLinkListsWithLeak(iRep, iObj, 10);

GC.Collect();
GC.WaitForPendingFinalizers();
Expand All @@ -85,6 +80,21 @@ public bool runTest(int iRep, int iObj)
}


[MethodImpl(MethodImplOptions.NoInlining)]
// Do not inline the method that creates GC objects, because it could
// extend their live intervals until the end of the parent method.
public void CreateDLinkListsWithLeak(int iRep, int iObj, int iters)
{
Mv_Doub = new DoubLink[iRep];
for (int i = 0; i < iters; i++)
{
SetLink(iRep, iObj);
MakeLeak(iRep);
GC.Collect();
}
}


public void SetLink(int iRep, int iObj)
{

Expand Down
28 changes: 19 additions & 9 deletions tests/src/GC/Scenarios/DoublinkList/dlbigleakthd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ namespace DoubLink {
using System.Threading;
using System;
using System.IO;
using System.Runtime.CompilerServices;

public class DLBigLeakThd
{
Expand Down Expand Up @@ -84,6 +85,23 @@ public static int Main(System.String [] Args)


public bool runTest(int iRep, int iObj, int iThd)
{
CreateDLinkListsWithLeak(iRep, iObj, iThd, 20);

GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();

int goal = iRep*15*iThd*iObj+20*iRep*iObj;
Console.WriteLine("{0}/{1} DLinkNodes finalized", DLinkNode.FinalCount, goal);
return (DLinkNode.FinalCount==goal);
}


[MethodImpl(MethodImplOptions.NoInlining)]
// Do not inline the method that creates GC objects, because it could
// extend their live intervals until the end of the parent method.
public void CreateDLinkListsWithLeak(int iRep, int iObj, int iThd, int iters)
{
this.iRep = iRep;
this.iObj = iObj;
Expand All @@ -94,7 +112,7 @@ public bool runTest(int iRep, int iObj, int iThd)
Mv_Thread[i] = new Thread(new ThreadStart(this.ThreadStart));
Mv_Thread[i].Start( );
}
for(int i=0; i<20; i++)
for (int i = 0; i < iters; i++)
{
SetLink(iRep, iObj);
MakeLeak(iRep);
Expand All @@ -103,15 +121,7 @@ public bool runTest(int iRep, int iObj, int iThd)
{
Mv_Thread[i].Join();
}

Mv_Doub = null;
GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();

int goal = iRep*15*iThd*iObj+20*iRep*iObj;
Console.WriteLine("{0}/{1} DLinkNodes finalized", DLinkNode.FinalCount, goal);
return (DLinkNode.FinalCount==goal);
}


Expand Down
23 changes: 16 additions & 7 deletions tests/src/GC/Scenarios/DoublinkList/dlcollect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,15 +93,9 @@ public bool DrainFinalizerQueue(int iRep, int iObj)

public bool runTest(int iRep, int iObj)
{
CreateDLinkListsWithLeak(iRep, iObj, 10);

Mv_Collect = new List<DoubLink>(iRep);
bool success = false;
for(int i=0; i <10; i++)
{
SetLink(iRep, iObj);
Mv_Collect.RemoveRange(0, Mv_Collect.Count);
GC.Collect();
}

if (DrainFinalizerQueue(iRep, iObj))
{
Expand All @@ -113,6 +107,21 @@ public bool runTest(int iRep, int iObj)
}


[MethodImpl(MethodImplOptions.NoInlining)]
// Do not inline the method that creates GC objects, because it could
// extend their live intervals until the end of the parent method.
public void CreateDLinkListsWithLeak(int iRep, int iObj, int iters)
{
Mv_Collect = new List<DoubLink>(iRep);
for(int i = 0; i < iters; i++)
{
SetLink(iRep, iObj);
Mv_Collect.RemoveRange(0, Mv_Collect.Count);
GC.Collect();
}
}


public void SetLink(int iRep, int iObj)
{
Mv_Doub = new DoubLink[iRep];
Expand Down
6 changes: 3 additions & 3 deletions tests/src/GC/Scenarios/DoublinkList/dlstack.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public bool DrainFinalizerQueue(int iRep, int iObj)

public bool runTest(int iRep, int iObj)
{
CreateDLinkListsWithLeak(iRep, iObj);
CreateDLinkListsWithLeak(iRep, iObj, 10);

bool success = false;
if (DrainFinalizerQueue(iRep, iObj))
Expand All @@ -111,9 +111,9 @@ public bool runTest(int iRep, int iObj)
[MethodImpl(MethodImplOptions.NoInlining)]
// Do not inline the method that creates GC objects, because it could
// extend their live intervals until the end of the parent method.
public void CreateDLinkListsWithLeak(int iRep, int iObj)
public void CreateDLinkListsWithLeak(int iRep, int iObj, int iters)
{
for(int i=0; i <10; i++)
for(int i = 0; i < iters; i++)
{
SetLink(iRep, iObj);
MakeLeak(iRep);
Expand Down
16 changes: 14 additions & 2 deletions tests/src/GC/Scenarios/DoublinkList/doublinkgen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ public bool DrainFinalizerQueue(int iRep, int iObj)

public bool runTest(int iRep, int iObj)
{
SetLink(iRep, iObj);
Mv_Doub = null;
CreateDLinkListsWithLeak(iRep, iObj);

bool success = false;

if (DrainFinalizerQueue(iRep, iObj))
Expand All @@ -107,6 +107,18 @@ public bool runTest(int iRep, int iObj)
}




[MethodImpl(MethodImplOptions.NoInlining)]
// Do not inline the method that creates GC objects, because it could
// extend their live intervals until the end of the parent method.
public void CreateDLinkListsWithLeak(int iRep, int iObj)
{
SetLink(iRep, iObj);
Mv_Doub = null;
}


public void SetLink(int iRep, int iObj)
{
for(int i=0; i<iRep; i++)
Expand Down
24 changes: 17 additions & 7 deletions tests/src/GC/Scenarios/DoublinkList/doublinknoleak.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
namespace DoubLink {
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;

public class DoubLinkNoLeak
{
Expand Down Expand Up @@ -62,13 +63,7 @@ public static int Main(System.String [] Args)

public bool runTest(int iRep, int iObj)
{
for(int i=0; i<10; i++)
{
SetLink(iRep, iObj);
}

Mv_Doub = null;
Mv_Save = null;
CreateDLinkListsWithLeak(iRep, iObj, 10);

GC.Collect();
GC.WaitForPendingFinalizers();
Expand All @@ -80,6 +75,21 @@ public bool runTest(int iRep, int iObj)
}


[MethodImpl(MethodImplOptions.NoInlining)]
// Do not inline the method that creates GC objects, because it could
// extend their live intervals until the end of the parent method.
public void CreateDLinkListsWithLeak(int iRep, int iObj, int iters)
{
for(int i = 0; i < iters; i++)
{
SetLink(iRep, iObj);
}

Mv_Doub = null;
Mv_Save = null;
}


public void SetLink(int iRep, int iObj)
{
Mv_Doub = new DoubLink[iRep];
Expand Down
23 changes: 16 additions & 7 deletions tests/src/GC/Scenarios/DoublinkList/doublinkstay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace DoubLink {
using System;
using System.Runtime.CompilerServices;

public class DoubLinkStay
{
Expand Down Expand Up @@ -63,13 +64,7 @@ public static int Main(System.String [] Args)

public bool runTest(int iRep, int iObj)
{
Mv_Doub = new DoubLink[iRep];
for(int i=0; i<20; i++)
{
SetLink(iRep, iObj);
MakeLeak(iRep);
}

CreateDLinkListsWithLeak(iRep, iObj, 20);

GC.Collect();
GC.WaitForPendingFinalizers();
Expand All @@ -83,6 +78,20 @@ public bool runTest(int iRep, int iObj)

}


[MethodImpl(MethodImplOptions.NoInlining)]
// Do not inline the method that creates GC objects, because it could
// extend their live intervals until the end of the parent method.
public void CreateDLinkListsWithLeak(int iRep, int iObj, int iters)
{
Mv_Doub = new DoubLink[iRep];
for(int i = 0; i < iters; i++)
{
SetLink(iRep, iObj);
MakeLeak(iRep);
}
}

public void SetLink(int iRep, int iObj)
{

Expand Down