Fix BSOD MEMORY_MANAGEMENT on low-RAM servers

- Dynamically compute JVM -Xmx based on system RAM instead of hardcoded 32g
- Reduce peak memory during session loading (inline JSON string, skip redundant clone)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Sucukdeluxe
2026-03-10 14:19:49 +01:00
co-authored by Claude Opus 4.6
parent 4b624693ec
commit 0a724aed71
3 changed files with 19 additions and 6 deletions
+4 -1
View File
@@ -1409,7 +1409,10 @@ export class DownloadManager extends EventEmitter {
this.appSessionStartedAt = startedAt;
this.runtimePersistedTotalMs = Math.max(0, Number(settings.totalRuntimeAllTimeMs || 0));
this.runtimePersistedAt = startedAt;
this.session = cloneSession(session);
// loadSession already returns a fresh, standalone object graph — no need to
// deep-clone again. This avoids duplicating the entire session in memory at
// startup which can spike peak heap on low-RAM servers.
this.session = session;
this.itemCount = Object.keys(this.session.items).length;
this.storagePaths = storagePaths;
this.debridService = new DebridService(settings, {