mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-11 16:57:39 +00:00
fix: clear lastNotes on CardFeedContentState.trimToSize() to release Note refs
CardFeedContentState.lastNotes holds strong references to every raw Note that passed the notification filter, used for additive dedup (filteredNewList.minus(lastNotesCopy)). Trimming only the Card list left all those Note objects pinned — they couldn't be GC'd even if LocalCache's SoftCache had evicted them. Fix: clear lastNotes/lastAccount alongside the Card list truncation. The next additive update finds lastNotes == null, skips the fast path, and calls refreshSuspended() — one controlled rebuild from LocalCache that also resets the dedup set to the current state. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019h2c44rAwexuUEP3kky2F3
This commit is contained in:
+7
@@ -411,6 +411,13 @@ class CardFeedContentState(
|
||||
val loaded = current.feed.value
|
||||
if (loaded.list.size > maxItems) {
|
||||
current.feed.tryEmit(LoadedFeedState(loaded.list.take(maxItems).toImmutableList(), loaded.showHidden))
|
||||
// lastNotes holds strong refs to every raw Note that was ever included in this
|
||||
// feed (used for additive-dedup). Clearing it releases those refs so the Notes
|
||||
// are no longer pinned in memory independently of LocalCache.
|
||||
// The next additive update will find lastNotes == null, skip the fast path, and
|
||||
// call refreshSuspended() — a single controlled rebuild from LocalCache.
|
||||
lastNotes = null
|
||||
lastAccount = null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user