Skip to content

Commit 383ab60

Browse files
committed
Use SystemPageSize
1 parent 3a988d1 commit 383ab60

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

src/BenchmarkDotNet/Disassemblers/ClrMdV2Disassembler.cs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,15 @@ private static ulong GetMinValidAddress()
2121
// https://github.com/dotnet/BenchmarkDotNet/pull/2413#issuecomment-1688100117
2222
if (RuntimeInformation.IsWindows())
2323
return 65536;
24+
if (RuntimeInformation.IsLinux())
25+
return (ulong) Environment.SystemPageSize;
2426
if (RuntimeInformation.IsMacOS())
2527
return RuntimeInformation.GetCurrentPlatform() switch
2628
{
2729
Environments.Platform.X86 or Environments.Platform.X64 => 4096,
2830
Environments.Platform.Arm64 => 0x100000000,
2931
_ => throw new NotSupportedException($"{RuntimeInformation.GetCurrentPlatform()} is not supported")
3032
};
31-
if (RuntimeInformation.IsLinux())
32-
{
33-
try
34-
{
35-
if (File.Exists("/proc/sys/vm/mmap_min_addr"))
36-
{
37-
string? minAddrResult = File.ReadAllText("/proc/sys/vm/mmap_min_addr");
38-
ulong.TryParse(minAddrResult, out ulong minAddress);
39-
return minAddress;
40-
}
41-
}
42-
catch { }
43-
return 0;
44-
}
4533
throw new NotSupportedException($"{System.Runtime.InteropServices.RuntimeInformation.OSDescription} is not supported");
4634
}
4735

0 commit comments

Comments
 (0)