namespace NATS.Server.Internal.SysMem;
///
/// Cross-platform system memory query helpers.
/// Go reference: server/sysmem/mem_*.go Memory
///
public static class SystemMemory
{
///
/// Returns total memory available to the runtime for the current OS.
///
public static long Memory()
{
var total = GC.GetGCMemoryInfo().TotalAvailableMemoryBytes;
if (total > 0)
return total;
// Conservative fallback when runtime does not report a limit.
return Environment.Is64BitProcess ? long.MaxValue : int.MaxValue;
}
}