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

内存泄漏 #43

Closed
ye13533167453 opened this issue Apr 7, 2023 · 3 comments
Closed

内存泄漏 #43

ye13533167453 opened this issue Apr 7, 2023 · 3 comments

Comments

@ye13533167453
Copy link

89a86003018bff586f79faccffb9b7b
python调用启动时,仅初始化只有100M左右,正常。
当ocr方法调用多次时,paddleOCR-json.exe进程的内存逐步飙到七百多M,而且,你停止调用ocr,内存并不会释放

@ye13533167453
Copy link
Author

而且,我尝试调用ocr方法的过程,改成单进程单线程,以此来避免并发的干扰,测试结果也是内存占用非常大,无法释放

@hiroi-sora
Copy link
Owner

这是PaddleOCR C++引擎的一个“特性”,内存占用非常激进。但是占用率不会无限制的上升,达到一定值后会放缓直至停止。一般不会因此导致崩溃的问题。

image

上图是我以前做的测试,内存主要是给mkldnn库吃了。这个库我改不了所以也无法确定是它的哪里出了问题。如果你想降低内存占用,则将引擎的mkldnn关了即可,传入 --enable_mkldnn=0 。注意这会降低识别速度。

或者,你可以参考我的 Umi-OCR v1.3.3 ,用手动重启引擎的方式来释放当前的内存占用。如果选择恰当的时机(如任务的空隙)重启,则对识别速度的影响较小。

@ye13533167453
Copy link
Author

非常感谢大神的解答,最近忙上线少,回复晚了,我用重启的形式来处理,曲线救国了

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