fix: enable service hibernation by default to reduce memory usage#2364
Open
phelix001 wants to merge 2 commits into
Open
fix: enable service hibernation by default to reduce memory usage#2364phelix001 wants to merge 2 commits into
phelix001 wants to merge 2 commits into
Conversation
isHibernationEnabled defaulted to false per service, which made the entire hibernation system non-functional: canHibernate always returned false, isHibernating was always false, and _hibernate() early-returned. Even hibernateOnStartup (which defaults to true) had no effect since it only sets isHibernationRequested, which is gated by canHibernate. This caused all service renderer processes (~170MB each) to run permanently regardless of user activity, leading to 2-3GB+ memory usage with 8+ services. Changes: - isHibernationEnabled: false → true (services now actually hibernate) - hibernationStrategy: 300 → 120 (hibernate after 2 min, not 5) - wakeUpStrategy: 300 → 0 (stay hibernated until user clicks) - isWakeUpEnabled: true → false (consistent with wakeUpStrategy) - Add backgroundThrottling=1 to webview webPreferences Expected savings: ~1.2GB for a typical 8-service setup. Fixes ferdium#2363 Related: ferdium#2197, ferdium#219, ferdium#647, ferdium#606 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…agent Clean up Chromium session (cache + flush storage) when services are hibernated, disabled, or deleted to release PartitionAlloc memory pools. Replace useragent-generator dependency with inline Chrome UA string to avoid compatibility issues. Add CLAUDE.md project instructions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
79ab327 to
fb45492
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
isHibernationEnableddefaulted tofalseper service, making the entire hibernation system non-functional —canHibernatealways returnedfalse, so services never hibernated even withhibernateOnStartup: truebackgroundThrottlingto webview webPreferences to throttle inactive service tabs before hibernation kicks inThe bug chain
DEFAULT_SERVICE_SETTINGS.isHibernationEnabled=false(src/config.ts:628)canHibernate=isHibernationEnabled && !isMediaPlaying→ alwaysfalseisHibernating=canHibernate && isHibernationRequested→ alwaysfalse_hibernate()early-returns on!service.canHibernatehibernateOnStartup: truesetsisHibernationRequestedbutisHibernatingstill returnsfalseResult: Every service runs a permanent Chromium renderer process (~170MB each) regardless of activity. 8 services = ~2.3GB.
Changes
isHibernationEnabledfalsetruehibernationStrategy'300'(5 min)'120'(2 min)wakeUpStrategy'300'(5 min)'0'(disabled)isWakeUpEnabledtruefalsebackgroundThrottling1Expected impact
~1.2GB freed for typical 8-service setup (7 hibernated × ~170MB). Only affects NEW services and fresh installs — existing users' per-service settings are persisted in the database.
Test plan
pnpm typecheckpassespnpm lintpasses (via pre-commit hook)pnpm test— 81 passed, 2 skippedFixes #2363
Related: #2197, #219, #647, #606
🤖 Generated with Claude Code