ele-admin / EasyCaptcha

Java图形验证码,支持gif、中文、算术等类型,可用于Java Web、JavaSE等项目。
Apache License 2.0
112 stars 25 forks source link

调用 SpecCaptcha.toBase64() 方法时,会导致系统内存持续上涨 #28

Open DBruceLee opened 4 years ago

DBruceLee commented 4 years ago
SpecCaptcha captcha = new SpecCaptcha(130, 48, 4);
System.out.println(captcha.toBase64());

调用 captcha.toBase64() 方法 会导致系统内存持续上涨,求解决方案
jaysunxiao commented 4 years ago

这个我也发现了

jaysunxiao commented 4 years ago

作者快点更新啊

jaysunxiao commented 4 years ago

所有的.toBase64()都会有内存上涨问题

jaysunxiao commented 4 years ago

image

写了一个while死循环一直toBase64(),然后内存都要炸了。

image

初步看了一下,这块可能有内存泄漏问题。

jaysunxiao commented 4 years ago

https://blog.csdn.net/loophome/article/details/101773866

作者可以参考这个博客,解决BufferedImage内粗溢出问题,作者赶快改啊!!!!!!!!!!!!!!!!!!!!!!!!!!!!

lohcve commented 4 years ago

https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8209113

不用等作者修复了,你可以升级你的jdk版本解决这个问题。

DBruceLee commented 4 years ago

目前用的是8,需要升级到哪个版本呢,线上应用不可能因为这一个功能升级版本呢

发自我的iPhone

------------------ 原始邮件 ------------------ 发件人: 李泽波 <notifications@github.com> 发送时间: 2020年9月8日 11:39 收件人: whvcse/EasyCaptcha <EasyCaptcha@noreply.github.com> 抄送: DBruceLee <1204504782@qq.com>, Author <author@noreply.github.com> 主题: 回复:[whvcse/EasyCaptcha] 调用 SpecCaptcha.toBase64() 方法时,会导致系统内存持续上涨 (#28)

https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8209113

不用等作者修复了,你可以升级你的jdk版本解决这个问题。

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

jaysunxiao commented 4 years ago

目前用的是8,需要升级到哪个版本呢,线上应用不可能因为这一个功能升级版本呢 发自我的iPhone ------------------ 原始邮件 ------------------ 发件人: 李泽波 <notifications@github.com> 发送时间: 2020年9月8日 11:39 收件人: whvcse/EasyCaptcha <EasyCaptcha@noreply.github.com> 抄送: DBruceLee <1204504782@qq.com>, Author <author@noreply.github.com> 主题: 回复:[whvcse/EasyCaptcha] 调用 SpecCaptcha.toBase64() 方法时,会导致系统内存持续上涨 (#28) https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8209113 不用等作者修复了,你可以升级你的jdk版本解决这个问题。 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

我用的jdk11都无法解决这个问题,最终只能缓存Font对象,不能每次都去床架Font

lohcve commented 3 years ago
JDK 11 JDK 13 JDK 14 JDK 8 Other
11.0.8Fixed 13.0.4Fixed 14 b27Fixed 8u281Fixed openjdk8u272Fixed
yoeaki commented 3 years ago
方案

您好,我最近也发现了这个问题,生成验证码引发内存大量上涨,此内存并不受jvm管控。 这是什么原因引起的呢?是堆外内存泄露么? 您目前找到解决方案了么?

yoeaki commented 3 years ago

JDK 11 JDK 13 JDK 14 JDK 8 Other 11.0.8Fixed 13.0.4Fixed 14 b27Fixed 8u281Fixed openjdk8u272Fixed

找不到jdk8u281这个版本呀!只看到最终版本8u271

yoeaki commented 3 years ago

我遇到这个问题时候,已经解决了,内存持续上涨是因为java的font字体管理存在内存泄露导致的。我原来用的是Java8u261和Java8u271,这个版本会存在内存泄露,然后更换了IBM的Java8u275得以解决这个问题,内存不在上涨。下载链接:https://adoptopenjdk.net/releases.html?variant=openjdk8&jvmVariant=openj9

jaysunxiao commented 3 years ago

https://github.com/zfoo-project/zfoo/tree/main/util/src/main/java/com/zfoo/util/captcha

高版本java中我缓存了Font对象才解决了这个问题,并且高版本java我用了spring自带的计算器

我用的jdk11,oracle和open jdk都有测试过