- skyline 内存泄漏如何解决 ?
基础库: 3.7.7 我参照 https://developers.weixin.qq.com/community/develop/doc/000ae8dd1bcdc093e061dcdbb61c00?highLine=%25E4%25BB%25A3%25E7%25A0%2581%25E6%25B3%2584%25E6%25BC%258F%25E5%25A4%2584%25E7%2590%2586 代码片段, 在开发者工具运行是可以可以复现,即页面没有被销毁,真机调试重复进入页面内存会递增, 使用 GC 后也没有减少,因为代码比较简单,不存在跨引用的场景, 我使用 webview 加载内存是正常回收的,我不知道有什么解决办法, 因为真机调试是编译过的,我就使用 weakSet 来监听页面(不知道能在 skyline 用嘛), 然后我真机反复执行 N 次后,最后看内存其实是稳定在一个范围,不会触发闪退, 但是我 GC 后, 页面仍然不会消除,而我这边实际业务逻辑代码很复杂,出现过 闪退的情况,所以我就不知道我该怎么办了 ,如果知道是哪些页面的问题,又该如何进行改进。 [图片] 我额外使用 阻止页面释放(webview 下是可行的),结果跟没阻止一样, skyline 下 同样的表现存放的 this 没有释放, 内存也会稳定在一个范围。 getApp().userInfoChangeListener = (userName) => { this.setData({userName}) } languageListener = ({lang}) => { this.setData({lang}) }
02-08 - 小程序隐私保护指引无法点击保存
因本次版本更新涉及写入相机图片的操作, 所以需要完善小程序隐私保护指引,否则无法提交送审, 但是在 《小程序隐私保护指引》 填写完毕后,无法点击提交, 只能预览, 想问下是什么具体问题,如何修改? 相关截图如下图所示 [图片] [图片] [图片]
02-01 - 在 官方的 typing 包中该函数是 使用了 void 函数返回, 打印没意义?
// 同步接口 try { const res = fs.writeFileSync( `${wx.env.USER_DATA_PATH}/hello.txt`, 'some text or arrayBuffer', 'utf8' ) console.log(res) } catch(e) { console.error(e) } https://developers.weixin.qq.com/miniprogram/dev/api/file/FileSystemManager.writeFileSync.html 关于同步的说明 , 此时打印 res 就没有意义,容易产生误导。 writeFileSync( /** 要写入的文件路径 (本地路径) */ filePath: string, /** 要写入的文本或二进制数据 */ data: string | ArrayBuffer, /** 指定写入文件的字符编码 * * 参数 encoding 可选值: * - 'ascii': ; * - 'base64': (注意,选择 base64 编码,data 只需要传 base64 内容本身,不要传 Data URI 前缀,否则会报 fail base64 encode error 错误。例如,传 aGVsbG8= 而不是传 data:image/png;base64,aGVsbG8= ); * - 'binary': ; * - 'hex': ; * - 'ucs2': 以小端序读取; * - 'ucs-2': 以小端序读取; * - 'utf16le': 以小端序读取; * - 'utf-16le': 以小端序读取; * - 'utf-8': ; * - 'utf8': ; * - 'latin1': ; */ encoding?: | 'ascii' | 'base64' | 'binary' | 'hex' | 'ucs2' | 'ucs-2' | 'utf16le' | 'utf-16le' | 'utf-8' | 'utf8' | 'latin1' ): void
01-04 - 使用 qiunDataCharts 无法使用代码保护功能,如何解决?
问题已经在多处反馈了, 我这个是 skyline 模式下遇到的问题, 错误提示是 动态引用 require , 要使用静态的, 但是我不知道怎么修改 QAQ,希望有个解决思路, 当前代码片段是组件化,另外原生我也是用,即直接用 uchart.min.js 会遇到一样的问题。 简化错误信息如下所示 message:common/vendor.js: Code protect is not available in common/vendor.js require is not being used properly in 'ObjectProperty' 23676 | } 23677 | function n(e2, t2, n2) { > 23678 | return e2(n2 = { path: t2, exports: {}, require: function(e3, t3) { | ^ 23679 | return function() { 23680 | throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs"); 23681 | }(null == t3 && n2.path);
2024-12-27