Skip to content

Commit fbbc052

Browse files
committed
(memory cont'ed)
1 parent 04b03c6 commit fbbc052

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

libraries/sdk/src/main/java/com/fastcomments/sdk/FastCommentsFeedSDK.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,25 @@ public void cleanup() {
625625
liveEventSubscription.close();
626626
liveEventSubscription = null;
627627
}
628+
// Clear listener references to prevent memory leaks
629+
this.onPostDeletedListener = null;
630+
631+
// Clear collections to help GC
632+
if (feedPosts != null) {
633+
feedPosts.clear();
634+
}
635+
if (postsById != null) {
636+
postsById.clear();
637+
}
638+
if (likeCounts != null) {
639+
likeCounts.clear();
640+
}
641+
if (myReacts != null) {
642+
myReacts.clear();
643+
}
644+
if (broadcastIdsSent != null) {
645+
broadcastIdsSent.clear();
646+
}
628647
}
629648

630649
/**

0 commit comments

Comments
 (0)