add nil check

This commit is contained in:
2025-03-22 21:58:38 +01:00
parent 48c66d429a
commit f4f64e1999

View File

@@ -879,7 +879,7 @@ func pollMemoryUsage(pid int, interval time.Duration, done chan bool, peakMem *i
}
totalMemory := totalRSS + totalSwap
if totalMemory > *peakMem {
if peakMem == nil || totalMemory > *peakMem {
peakMem = &totalMemory
}