Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelsavara committed Feb 20, 2024
1 parent 9dc6ea6 commit 5a4e4c9
Showing 1 changed file with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.IO;
using System.Threading.Tasks;
using System.Threading;
using System.Collections.Generic;
using Xunit;

namespace System.Runtime.InteropServices.JavaScript.Tests
Expand Down Expand Up @@ -470,6 +471,42 @@ await executor.Execute(async () =>
}, cts.Token);
}

[OuterLoop]
[Fact]
public async Task VeryLongRunningGC()
{
using var cts = new CancellationTokenSource();
for(int i=0;i<100;i++)
{
var executor = new Executor(ExecutorType.NewThread);
Console.WriteLine("VeryLongRunningGC " + executor.Type + " " + i);
await executor.Execute(() =>
{
long cnt = 0;
long[] data = new long[1024*1024*32];
var end = DateTime.Now + TimeSpan.FromMilliseconds(10000);
do
{
// these are just dummy computations to keep CPU busy
Interlocked.Increment(ref cnt);
data = new long[1024*1024*32];
data[0] = cnt;

// force some GC
if(cnt % 10000 == 0)
{
GC.Collect();
var total = GC.GetTotalMemory(true);
Console.WriteLine("GC.GetTotalMemory: "+total);
}
}
while(DateTime.Now<end);

return Task.CompletedTask;
}, cts.Token);
}
}

#endregion

#region Thread Affinity
Expand Down

0 comments on commit 5a4e4c9

Please sign in to comment.