rainbow
rainbow copied to clipboard
Fix memory leak in cool modals
Fixes RNBW-#### Figma link (if any):
This was a regression caused by https://github.com/rainbow-me/rainbow/pull/1142
However, the original bug was already fixed in reanimated so this fix is not needed. Also, I expect that this particular line was unintentional anyway
See the bug here (sorry for the image quality, this is the screenshot for the video):
before https://streamable.com/em0d2t
after: https://streamable.com/nvgoxe
Observe the memory chart changing:
Before: https://streamable.com/e0kxpe After:https://streamable.com/0vkpty
Before after 1 minute
After fix after almost 2 minutes
(see recording for the documentation of the more precise experiments)
There is still something broken (maybe this is just JS logic), but definitely, the derivative of the growth decreased so it's an improvement.
What changed (plus any additional context for devs)
I restored commented out line cause setting controller to null
. This is important because in this structure (that is a bit incorrect, but ok) controller
is holding view
(RNCMScreen
and RNCMScreeView
) and vice versa. This is not java GC, but ARC (not having GC to be precise), which means that as long as the memory holds the reference for the object, it doesn't get deallocated. Here, one object keeps ref to another and the other way.
I fixed this in a way this was supposed to be fixed originally.
This was previously not discovered vie leak tool because of the fact that this is not an alienated object not being deallocated but the whole structure that was most likely too big to be noticed to be separated.
/rebase
/rebase
/rebase
@estrattonbailey Did you have any intentions with closing and reopening? I will assign myself to that to see if we can merge it
APP-1 Take Memory leak in cool modals PR to the finish line
It was opened by Michał and needs some action to get it closed
It has some issues, we shouldn't merge it in this state. Gonna create linear tickets for that to address the memory leaks and link this PR
The issues are presented below, it happens for send flow of all assets
https://user-images.githubusercontent.com/16062886/196479668-2ba7e3ad-b193-4837-a906-a97b85370121.mov