1***@qq.com
1***@qq.com
  • 发布:2026-07-20 16:09
  • 更新:2026-07-20 16:09
  • 阅读:38

nvue 页面 <list> 切 tab 后 Views 只增不减,Native Heap 持续增长

分类:uni-app

环境
Uniapp 版本:2.x(Vue2)
页面类型:nvue
测试设备:联发科 PDA(Android 10,1.9G RAM)、华为手机(Android 10)

复现步骤
有一个 nvue 页面,使用 <swiper> + <list> + <cell> 做多 tab 订单列表(4 个 tab)
每个 tab 的订单数据约 10-15 条
切 tab 时做了 renderCount = 0 清空列表渲染
反复切换 tab,通过 adb shell dumpsys meminfo 监控

现象
时间 Views Native Heap 操作
刚启动 135 40MB 打开页面
切换4个tab一轮 1,286 62MB 正常使用
1-2小时后反复切换 5,984 117MB 只增不减
Views 和 Native Heap 只增不减,renderCount = 0、list = []、System.gc() 均无效。

问题
nvue 的 <list> / <cell> 是否有已知的 View 泄漏问题?
除了销毁页面(onUnload),有没有办法在页面存活期间回收 Weex Native View?
是否推荐切回 Vue 页面用 WebView 渲染来解决?


// 切 tab 时释放旧 tab  
currentChange(item) {  
    const prevTabValue = this.status[this.current]?.value  
    if (prevTabValue && this.tabList[prevTabValue]) {  
        this.tabList[prevTabValue].renderCount = 0  
    }  
    this.current = index  
    // ...重新加载新 tab  
}  

// getRenderList 根据 renderCount 控制渲染数量  
getRenderList(tabValue) {  
    const { list, renderCount } = this.tabList[tabValue]  
    if (!renderCount || renderCount >= list.length) return list  
    return list.slice(0, renderCount)  
}  
2026-07-20 16:09 负责人:无 分享
已邀请:

要回复问题请先登录注册