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

会存在内存泄漏问题呢。不知道是不是使用问题,帮忙分析下呢 #3

Closed
annen6um opened this issue May 10, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@annen6um
Copy link

目前是在一个定时任务类中调用这个ocrEngine
我在代码块中初始化的engine
static {
engine = OCREngine.instance();
log.info("OCR引擎初始化完成");
}
现在存在的问题是每调用一次engine.recognize(read);内存就会彪高一点,直至把内存撑爆。

为了避免是使用错误,我还特意用了第三方的验证码识别服务,替换本地ocr识别的方式,测试了几个小时,发现内存很稳定,没有问题。大佬能帮忙分析下不

@GCS-ZHN
Copy link
Owner

GCS-ZHN commented May 23, 2023

测试了一下,确实存在这个现象,感谢反馈,后续修复一下。

@annen6um
Copy link
Author

好的,谢谢

@GCS-ZHN GCS-ZHN added the bug Something isn't working label May 23, 2023
@GCS-ZHN
Copy link
Owner

GCS-ZHN commented May 23, 2023

经过进一步测试发现,似乎如果主动触发System.gc(),通知JVM回收对象,这样才会快速回收内存。

@annen6um
Copy link
Author

是的,我暂时没找到具体原因,麻烦排查出原因之后发出来学习学习呗,谢谢

@ilxyil
Copy link

ilxyil commented Nov 12, 2023

已解决,直接无偿公开了哈,这两个新建的资源也需要被关闭,否则会占用堆外内存,直接拉dump看不出来问题
image

@GCS-ZHN
Copy link
Owner

GCS-ZHN commented Nov 12, 2023

已解决,直接无偿公开了哈,这两个新建的资源也需要被关闭,否则会占用堆外内存,直接拉dump看不出来问题

image

谢谢您,您可以直接提交一个PR,我之前一直忙于工作所以没有处理,确实需要对tensor输入输出进行close。

GCS-ZHN added a commit that referenced this issue Nov 20, 2023
@GCS-ZHN
Copy link
Owner

GCS-ZHN commented Nov 20, 2023

已经在新的release中修复

@GCS-ZHN GCS-ZHN closed this as completed Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants