test(opcua): package cross-platform lifecycle memory controls

This commit is contained in:
Joseph Doherty
2026-11-10 14:16:57 -05:00
parent a1f5028fe6
commit 6f793d2521
12 changed files with 2023 additions and 0 deletions
@@ -0,0 +1,22 @@
using System.Diagnostics;
using System.Runtime;
using System.Text.Json;
using Microsoft.Extensions.Logging;
using Opc.Ua;
var dispose = args[0] == "dispose";
for (int i = 0; i <= 10000; i++)
{
if (i > 0)
{
var t = DefaultTelemetry.Create(_ => { });
t.LoggerFactory.CreateLogger("TelemetryControl").LogDebug("control");
if (dispose) ((IDisposable)t).Dispose();
}
if (i % 250 == 0)
{
var live = GC.GetTotalMemory(true);
using var p = Process.GetCurrentProcess();
p.Refresh();
Console.WriteLine(JsonSerializer.Serialize(new { i, dispose, live, rss = p.WorkingSet64, methods = JitInfo.GetCompiledMethodCount(), il = JitInfo.GetCompiledILBytes(), gc = GC.GetGCMemoryInfo().TotalCommittedBytes, threads = p.Threads.Count, timers = Timer.ActiveCount }));
}
}