taro icon indicating copy to clipboard operation
taro copied to clipboard

Taro2 组件使用 Redux Hooks API ,页面卸载时页面实例无法卸载(组件实例也无法卸载),导致小程序内存泄漏。

Open chuyun opened this issue 2 years ago • 2 comments

相关平台

微信小程序

小程序基础库: 2.21.2 使用框架: Taro V2

复现步骤

import { useSelector, useDispatch } from '@tarojs/redux'

小程序组件中使用 useDispatch useSelector等API,在页面退出时,页面及组件实例不会被释放

期望结果

正常释放页面及组件实例

实际结果

无法释放,导致内存泄漏问题

环境信息


👽 Taro v2.2.17

  Taro CLI 2.2.17 environment info:
    System:
      OS: macOS 12.5.1
      Shell: 5.8.1 - /bin/zsh
    Binaries:
      Node: 14.15.4 - ~/.nvm/versions/node/v14.15.4/bin/node
      Yarn: 1.22.10 - ~/.nvm/versions/node/v14.15.4/bin/yarn
      npm: 6.14.10 - ~/.nvm/versions/node/v14.15.4/bin/npm
    npmPackages:
      @tarojs/components: 2.2.17 => 2.2.17 
      @tarojs/components-qa: 2.2.17 => 2.2.17 
      @tarojs/mini-runner: 2.2.17 => 2.2.17 
      @tarojs/plugin-less: 2.2.17 => 2.2.17 
      @tarojs/plugin-sass: 2.2.17 => 2.2.17 
      @tarojs/plugin-terser: 2.2.17 => 2.2.17 
      @tarojs/plugin-uglify: ^2.2.10 => 2.2.10 
      @tarojs/redux: 2.2.17 => 2.2.17 
      @tarojs/redux-h5: 2.2.17 => 2.2.17 
      @tarojs/router: 2.2.17 => 2.2.17 
      @tarojs/taro: 2.2.17 => 2.2.17 
      @tarojs/taro-alipay: 2.2.17 => 2.2.17 
      @tarojs/taro-h5: 2.2.17 => 2.2.17 
      @tarojs/taro-qq: 2.2.17 => 2.2.17 
      @tarojs/taro-quickapp: 2.2.17 => 2.2.17 
      @tarojs/taro-swan: 2.2.17 => 2.2.17 
      @tarojs/taro-tt: 2.2.17 => 2.2.17 
      @tarojs/taro-weapp: 2.2.17 => 2.2.17 
      @tarojs/webpack-runner: 2.2.17 => 2.2.17 
      eslint-config-taro: 2.2.17 => 2.2.17 
      eslint-plugin-taro: 2.2.17 => 2.2.17 
      nerv-devtools: ^1.5.7 => 1.5.7 
      nervjs: ^1.5.7 => 1.5.7 
      react: ^17.0.2 => 17.0.2 
      stylelint-config-taro-rn: 2.2.17 => 2.2.17 
      stylelint-taro-rn: 2.2.17 => 2.2.17 
      taro-ui: ^2.3.4 => 2.3.4 

chuyun avatar Sep 07 '22 08:09 chuyun

最小化重现Demo: https://github.com/chuyun/redux-memory-leak-mvp

chuyun avatar Sep 07 '22 12:09 chuyun

这个有人在看吗,感觉是严重的问题

towry avatar May 10 '24 08:05 towry