This repository has been archived by the owner on Mar 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 364
[BUG]当某个jsx销毁时,jsx上类似onTap等函数的引用仍然挂在page上。看了源码没有函数引用的销毁动作 #1780
Labels
bug
Something isn't working
Comments
+1 我也遇到了同样的问题,当节点复杂的时候,内存增长很快。目前是否有解决办法? |
能否给我提供一下小的复现 repo |
yesmeck
added a commit
that referenced
this issue
Jan 11, 2022
yesmeck
added a commit
that referenced
this issue
Jan 11, 2022
yesmeck
added a commit
that referenced
this issue
Jan 11, 2022
yesmeck
added a commit
that referenced
this issue
Jan 11, 2022
可以试下 2.15.12 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
bug 描述
类似于bindtap等函数的回调,函数的引用会挂在page上。当某个jsx销毁时,对应bindtap函数的引用仍然挂在page上,引用没有删除,有内存泄漏的风险。
复现步骤
看下面的代码,点击视图后,会 setState(true),这时候新的视图没有bindtap类似的回调。所以期待的是旧视图的bindtap回调应该在page中小时,可是在新视图渲染后2s甚至更长时间,$$REMAX_METHOD_5_onTap的引用没有消失。
看了一下源码,源码中没有类似删除回调的方法。建议在2个地方进行引用的删除。① removeChild时,遍历prop ② diffProperties 时,lastProps 存在,nextProps 不存在的回调
期望结果
代码在下面,希望在setTimeout 回调调用后,$$REMAX_METHOD_5_onTap对应的函数引用消失
复现代码
版本信息:
其他信息
[如截图等其他信息可以贴在这里]
The text was updated successfully, but these errors were encountered: