mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-08 23:54:39 +00:00
fix: move cleanObservers to Tier 1 in MemoryTrimmingService
cleanObservers() only removes flows not currently held by the UI, so it carries no visible side effects and is safe to run on every trim regardless of pressure level. Move it from Tier 3 (RUNNING_CRITICAL) to Tier 1 (always) so unused observer links are freed even on mild memory signals. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+4
-3
@@ -53,8 +53,10 @@ class MemoryTrimmingService(
|
||||
otherAccounts: List<AccountInfo>,
|
||||
level: Int,
|
||||
) {
|
||||
// Tier 1: always run — cheap housekeeping
|
||||
// Tier 1: always run — cheap housekeeping; cleanObservers only removes flows that are
|
||||
// not currently held by the UI, so it is safe and inexpensive at any pressure level.
|
||||
cache.cleanMemory()
|
||||
cache.cleanObservers()
|
||||
cache.pruneExpiredEvents()
|
||||
cache.prunePastVersionsOfReplaceables()
|
||||
|
||||
@@ -66,8 +68,7 @@ class MemoryTrimmingService(
|
||||
}
|
||||
|
||||
if (level >= ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL) {
|
||||
// Tier 3: critical pressure — sever observer links and drop muted content
|
||||
cache.cleanObservers()
|
||||
// Tier 3: critical pressure — drop muted content
|
||||
account.forEach {
|
||||
cache.pruneHiddenEvents(it)
|
||||
cache.pruneHiddenMessages(it)
|
||||
|
||||
Reference in New Issue
Block a user