Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
功能描述
解决批量下载大量歌曲(1000+)时出现的内存泄漏问题。实现了一个轻量级的 LRU(最近最少使用)缓存清理系统,防止长时间下载导致的内存无限增长。
问题背景
解决方案
1. 新增内存管理模块
src/utils/downloadCleanupManager.js2. 集成到批量下载流程
src/components/batchDownloadSongs.jsaddPendingCleanup()3. 修复导入路径
src/playlist/playlistDetail.jsSongsDownUpLoad→songsDownUpLoad(Linux 大小写敏感)清理策略详解
下载过程中 (1-16 项) 下载过程中 (>16 项) 下载完成
保留全部缓存 → LRU 自动清理 → 保留缓存
↓
用户刷新页面后清除
测试结果
✅ 支持一次性下载 1000+ 首歌曲
✅ 内存占用保持在可控水平(最多 16 个文件的缓存)
✅ 下载稳定性不受影响
✅ 用户无需手动清理,刷新后自动清除