Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

内存占用 #53

Closed
bao-qian opened this issue May 19, 2020 · 7 comments
Closed

内存占用 #53

bao-qian opened this issue May 19, 2020 · 7 comments

Comments

@bao-qian
Copy link

bao-qian commented May 19, 2020

你好,
使用了你的库 c# 版本,发现内存占用很大。

程序启动的时候调用二十次左右 WordsHelper.GetFirstPinyin,内存占用会飙升至 1G 左右。
有什么好办法可以减小内存占用吗?

memory profile 结果
image

@toolgood
Copy link
Owner

能上传一下测试代码吗?

@bao-qian
Copy link
Author

代码在这里,我尽快上传一份可以复现的最小代码。

https://github.com/Wox-launcher/Wox/blob/master/Wox.Infrastructure/Alphabet.cs#L41-L47

@toolgood
Copy link
Owner

仔细研究代码后,PinyinDict是懒加载,只加载一次,最多消耗87M,使用WordsSearchEx来加载可降低到40M,感觉是多线程(并发情况下)没有加锁。
就在刚才测试了代码,发现你的代码的确是在多线程执行的。

@bao-qian
Copy link
Author

@toolgood
能不能多线程下共享加载资源?

@toolgood
Copy link
Owner

已修改,最新使用3.0.1.2 版本

@toolgood
Copy link
Owner

我看了一下Wox使用内存在140M左右

@bao-qian
Copy link
Author

感谢,确认已修复。

bao-qian added a commit to Wox-launcher/Wox that referenced this issue May 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants