MCPcopy Create free account
hub / github.com/PostHog/duckgres / SystemMemoryBytes

Function SystemMemoryBytes

server/sysinfo/sysinfo.go:23–28  ·  view source on GitHub ↗

SystemMemoryBytes returns total physical memory in bytes, cached after first call. Returns 0 if the system memory cannot be detected (e.g., on non-Linux systems).

()

Source from the content-addressed store, hash-verified

21// SystemMemoryBytes returns total physical memory in bytes, cached after first call.
22// Returns 0 if the system memory cannot be detected (e.g., on non-Linux systems).
23func SystemMemoryBytes() uint64 {
24 systemMemoryBytesOnce.Do(func() {
25 systemMemoryBytesValue = readSystemMemoryBytes()
26 })
27 return systemMemoryBytesValue
28}
29
30// readSystemMemoryBytes reads total physical memory from /proc/meminfo on Linux.
31// Returns 0 if the file cannot be read or parsed (e.g., on non-Linux systems).

Callers 1

AutoMemoryLimitFunction · 0.85

Calls 2

readSystemMemoryBytesFunction · 0.85
DoMethod · 0.80

Tested by

no test coverage detected