tlsf briefly ok, debugging

This commit is contained in:
Youmu Liu
2026-05-12 18:25:48 +08:00
parent a99b19fa3f
commit bf9879f59f
5 changed files with 388 additions and 168 deletions
+2 -2
View File
@@ -53,9 +53,9 @@ namespace StgSharp
.InitializeModule();
// TestRegexAnalyse.Run();
TestHlsf();
// TestHlsf();
// HlsfStressTest.Run();
TlsfStressTest.Run();
// TestSwiss();
// TestL4Prefetch();
+21 -7
View File
@@ -85,10 +85,17 @@ namespace StgSharp
List<Tlsf.Handle> batch = new(maxCount);
for (int i = 0; i < maxCount; i++)
{
uint sz = sizes[rnd.Next(sizes.Length)];
batch.Add(hlsfAllocator.Alloc(sz));
// Console.WriteLine($"alloced:{i}");
try
{
uint sz = sizes[rnd.Next(sizes.Length)];
batch.Add(hlsfAllocator.Alloc(sz));
}
catch (Exception e)
{
Console.WriteLine($"alloced:{round},{i}");
Console.WriteLine(e);
throw;
}
}
for (int i = 5; i < maxCount; i += 10)
{
@@ -99,9 +106,16 @@ namespace StgSharp
}
for (int i = batch.Count - 1; i >= 0; i--)
{
hlsfAllocator.Free(batch[i]);
// Console.WriteLine($"freed:{i}");
try
{
hlsfAllocator.Free(batch[i]);
}
catch (Exception e)
{
Console.WriteLine($"freed:{round},{i}");
Console.WriteLine(e);
throw;
}
}
if (round % 100 == 0)
{