-
Notifications
You must be signed in to change notification settings - Fork 841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak in ViewGroupMviDelegateImpl #310
Labels
Comments
Thanks for the detailed explanation.
I have to check out the related code next week. Honestly, I can't remember
whats going on internally :)
Alexander Zhdanov <notifications@github.com> schrieb am Sa., 28. Apr. 2018,
09:58:
… Hello!
I found a memory leak in ViewGroupMviDelegateImpl.
Mosby version is 3.1.0.
Steps to reproduce:
- create CustomView extending MviFrameLayout or MviLinearLayout or
MviRelativeLayout
- programmaticaly add this CustomView to view hierarchy while activity
is resumed
- programmaticaly remove this CustomView from view hierarchy while
activity is resumed
After that CustomView will be in memory until activity is destroyed.
I also found that this is because of registering
ActivityLifecycleCallbacks when creating ViewGroupMviDelegateImpl.
ViewGroupMviDelegateImpl removes ActivityLifecycleCallbacks only when
activity is destroyed. But there may a lot of such CustomView those will
hang in memory though they are detached and removed from view hierarchy.
I reviewed logic of consuming activity-lifecycle in
ViewGroupMviDelegateImpl and may be we can register
ActivityLifecycleCallbacks when attaching view to presenter and
unregister ActivityLifecycleCallbacks in two cases: when activity is
destroying and also when detaching view from presenter ?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#310>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAjnrk7HcRi4n-5dbyOkpn3nro-Fz8LIks5ttCFCgaJpZM4TrTJj>
.
|
+1 I have experienced this issue too, caught it with Leak Canary. |
qwert2603
added a commit
to qwert2603/andrlib
that referenced
this issue
May 3, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello!
I found a memory leak in ViewGroupMviDelegateImpl.
Mosby version is 3.1.0.
Steps to reproduce:
CustomView
extendingMviFrameLayout
orMviLinearLayout
orMviRelativeLayout
CustomView
to view hierarchy while activity is resumedCustomView
from view hierarchy while activity is resumedAfter that
CustomView
will be in memory until activity is destroyed.I also found that this is because of registering
ActivityLifecycleCallbacks
when creatingViewGroupMviDelegateImpl
.ViewGroupMviDelegateImpl
removesActivityLifecycleCallbacks
only when activity is destroyed. But there may be a lot of suchCustomView
those will hang in memory though they are detached and removed from view hierarchy.I reviewed logic of consuming activity-lifecycle in
ViewGroupMviDelegateImpl
and may be we can registerActivityLifecycleCallbacks
when attaching view to presenter and unregisterActivityLifecycleCallbacks
in two cases: when activity is destroying and also when detaching view from presenter ?The text was updated successfully, but these errors were encountered: