Atoll: raise MemoryUsageMonitor threshold to 4 GiB in DEBUG builds

The 1 GiB resident-size threshold is reasonable for a release build,
but Swift/SwiftUI debug builds plus the AVPlayer-backed Canvas video
pipeline and SkyLight overlay windows can easily exceed it during
normal Xcode-attached development. The restart-alert dialog firing
mid-development is disruptive and not actionable.

Keep the 1 GiB safety net on release, raise to 4 GiB in DEBUG so
developers running under Xcode aren't interrupted by spurious
restart prompts. The poll interval, cooldown, and alert text all
stay the same.

Signed-off-by: Jis G Jacob <studiokeys@blissroms.org>
This commit is contained in:
Jis G Jacob 2026-05-12 16:10:50 +05:30
commit 43f1fb4283

View file

@ -24,7 +24,11 @@ import Darwin
final class MemoryUsageMonitor { final class MemoryUsageMonitor {
static let shared = MemoryUsageMonitor() static let shared = MemoryUsageMonitor()
#if DEBUG
private let thresholdBytes: UInt64 = 4 * 1_024 * 1_024 * 1_024
#else
private let thresholdBytes: UInt64 = 1_024 * 1_024 * 1_024 private let thresholdBytes: UInt64 = 1_024 * 1_024 * 1_024
#endif
private let pollInterval: TimeInterval = 8 // Clamp within 5-10 seconds to limit battery impact private let pollInterval: TimeInterval = 8 // Clamp within 5-10 seconds to limit battery impact
private let restartCooldown: TimeInterval = 300 private let restartCooldown: TimeInterval = 300
private let logSampleInterval: TimeInterval = 300 private let logSampleInterval: TimeInterval = 300