revolution-irc icon indicating copy to clipboard operation
revolution-irc copied to clipboard

Memory leak

Open MCMrARM opened this issue 7 years ago • 6 comments

It looks like I have a memory leak in the application... Just after starting the application the memory usage is just above 100MB. After leaving the application for a day it starts to consume over 200MB. One time the application crashed because of an out of memory error, with the application trying to consume over 600MB.

MCMrARM avatar Oct 31 '17 10:10 MCMrARM

MainActivity was leaked as a result of a bug I fixed in https://github.com/MCMrARM/revolution-irc/commit/564a5794058c9d719efabdca668363001243a437. I am unsure if this is the only leak that was there.

MCMrARM avatar Oct 31 '17 17:10 MCMrARM

Found another leak. Someone decided that it'd be a great idea that SpannableString's constructor would copy NoCopySpans (SpannableStringBuilder's does not copy them though). It ended up copying a TextView.ChangeWatcher span which has a reference to the TextView that contained the text and that TextView had a reference to an Activity. Fixed with https://github.com/MCMrARM/revolution-irc/commit/2d7cad9ddbdc5fd7780d233ed9e53118becbbb03

MCMrARM avatar Nov 01 '17 12:11 MCMrARM

I don't think anything else leaks MainActivity so I'll close this for now. If I'll see any other memory leak I'll reopen it.

MCMrARM avatar Nov 01 '17 12:11 MCMrARM

Unfortunately it looks like there is another memleak (perhaps of the SQLite database handles), as the app uses >150MB again.

MCMrARM avatar Nov 02 '17 15:11 MCMrARM

There is reference to context in singleton .config.SettingsHelper. I think this might be one of the source of leak.

Rushi98 avatar Dec 30 '19 07:12 Rushi98

No, that is fine.

MCMrARM avatar Dec 30 '19 12:12 MCMrARM