1
0
mirror of https://github.com/moparisthebest/Yaaic synced 2024-11-12 12:05:03 -05:00
Yaaic/application/src/org/yaaic/model
Steven Luo ffe73b7c9f Hold MessageListAdapters and MessageListViews in DeckAdapter to avoid leaks
There are at least two significant memory leaks in Yaaic, which cause
the client to force close after a few hours with an
OutOfMemoryException:

(1) The IRCService holds Conversation objects, which contain a
MessageListAdapter, which have references to the ConversationActivity
context.  This causes Activity contexts to outlast the Activity, causing
a significant memory leak over time.

Fix this by holding the MessageListAdapter in the ConversationActivity's
DeckAdapter instead of in the Conversation objects.  The DeckAdapter's
lifecycle matches that of the Activity, so this prevents the leak.

(2) Every call to DeckAdapter.getView()/renderConversation() creates a
new MessageListView and adds it to the deck.  But adding the view to
the deck causes the deck to take a reference to the view, leaking the
MessageListView until the Activity is finished.  (This has the effect of
exacerbating the first leak, since the Activity context holds a
reference to the deck.)

Fix this leak by caching MessageListViews in the DeckAdapter, and
returning an existing MessageListView for a Conversation in getView() if
one already exists.
2011-06-08 23:11:28 +02:00
..
Broadcast.java Added 2011 to licence header 2011-02-05 13:00:12 +01:00
Channel.java Added 2011 to licence header 2011-02-05 13:00:12 +01:00
Conversation.java Hold MessageListAdapters and MessageListViews in DeckAdapter to avoid leaks 2011-06-08 23:11:28 +02:00
Extra.java Added 2011 to licence header 2011-02-05 13:00:12 +01:00
Identity.java Some more simple refactorings 2011-03-14 22:15:13 +01:00
Message.java Remove color codes if the mirc colors option is off. Fixes #57 2011-04-14 22:53:38 +02:00
Query.java Added 2011 to licence header 2011-02-05 13:00:12 +01:00
Scrollback.java Added 2011 to licence header 2011-02-05 13:00:12 +01:00
Server.java Server: Fix typo in addConversation() 2011-03-15 23:59:49 +01:00
ServerInfo.java Added 2011 to licence header 2011-02-05 13:00:12 +01:00
Settings.java Add support for graphical smilies in chat. 2011-03-27 19:51:47 +02:00
Status.java Some more simple refactorings 2011-03-14 22:15:13 +01:00
User.java New user action view and new actions: reply, query 2011-02-05 16:04:36 +01:00