perf(deployer): release memory to OS after batch dictionary compilation on glibc - #1200
perf(deployer): release memory to OS after batch dictionary compilation on glibc#1200EasternLi wants to merge 2 commits into
Conversation
|
我拜讀了 https://www.reddit.com/r/C_Programming/comments/13dn8d7/is_malloc_trim_safe_to_use/ 不太看好這項修改。 若系統的內存管理策略便是如此、不急回收,用家爲何如此執着於統計數字? |
因为实际表现不是“不急回收”,而是“不再回收”,看起来与一次性的“内存泄漏”并无区别。 |
這是推測,還是有實證呢。 聽上去 glibc 的自動內存回收機制完全沒有正常工作。 我選擇謹慎。 如果問題不出在 glibc——很有可能不是,不是說 macOS 也如此表現麼,那這個修改就屬於 hack 沒有找到真正的病因。 |
在我环境上确实如此。我使用的词典是 https://github.com/iDvel/rime-ice + https://github.com/felixonmars/fcitx5-pinyin-zhwiki + https://github.com/outloudvi/mw2fcitx 。词典较大所以被占的内存也偏多,经常会注意到 fcitx5 进程占用的 RSS/SWAP 超过 1G 。
我不太清楚 macOS 上的具体行为,也许系统内存紧张时就会自动释放? 这里声称 macOS 上的 从 |
|
如果要在上游实现,或许可以用 dlsym。 |
|
要不先在 fcitx-rime 裏面折騰,看看效果? |
实在没找到直接的检测方法,就用 |
合到 fcitx-rime 里的话,跟内存消耗的诱因词典编译有点分离了。 |
Pull request
Issue tracker
Manual test