gpt4 book ai didi

java - JMagick 和 JVM 崩溃

转载 作者:行者123 更新时间:2023-11-30 05:56:18 26 4
gpt4 key购买 nike

我正在使用JMagick并有一个简单的 Java 类,该类循环遍历目录(及其子目录)中的所有图像,将图像转换为灰度图像。

我的应用程序运行一段时间后,JVM 崩溃了。我相信日志中的错误消息可能表明存在内存问题:

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code) j magick.MagickImage.writeImage(Lmagick/ImageInfo;)Z+0 j com.example.ImageGenerator.generateAlternativeImages(Ljava/io/File;Z)V+91 j com.example.ImageGenerator.main([Ljava/lang/String;)V+58 v ~StubRoutines::call_stub

--------------- P R O C E S S ---------------

Java Threads: ( => current thread ) 0x0ab0c800 JavaThread "Low Memory Detector" daemon [_thread_blocked, id=1532, stack(0x0aec0000,0x0af10000)] 0x0ab0ac00 JavaThread "CompilerThread0" daemon [_thread_blocked, id=7304, stack(0x0ae70000,0x0aec0000)] 0x0aafe000 JavaThread "JDWP Command Reader" daemon [_thread_in_native, id=6836, stack(0x0ae20000,0x0ae70000)] 0x0aafc800 JavaThread "JDWP Event Helper Thread" daemon [_thread_blocked, id=7248, stack(0x0add0000,0x0ae20000)] 0x0aafa400 JavaThread "JDWP Transport Listener: dt_socket" daemon [_thread_blocked, id=6252, stack(0x0ad80000,0x0add0000)] 0x0aaee800 JavaThread "Attach Listener" daemon [_thread_blocked, id=2020, stack(0x0aca0000,0x0acf0000)] 0x0aaed400 JavaThread "Signal Dispatcher" daemon [_thread_blocked, id=7492, stack(0x0ac50000,0x0aca0000)] 0x0aada400 JavaThread "Finalizer" daemon [_thread_blocked, id=5400, stack(0x0ac00000,0x0ac50000)]
0x0aad8c00 JavaThread "Reference Handler" daemon [_thread_blocked, id=5772, stack(0x0abb0000,0x0ac00000)] =>0x002b8000 JavaThread "main" [_thread_in_native, id=7020, stack(0x008c0000,0x00910000)]

Other Threads: 0x0aad5400 VMThread [stack: 0x0ab60000,0x0abb0000] [id=7720] 0x0ab0f000 WatcherThread [stack: 0x0af10000,0x0af60000] [id=6432]

VM state:not at safepoint (normal execution)

VM Mutex/Monitor currently owned by a thread: None

Heap def new generation total 960K, used 793K [0x029c0000, 0x02ac0000, 0x02ea0000) eden space 896K, 88% used [0x029c0000, 0x02a865f0, 0x02aa0000) from space 64K, 0% used [0x02aa0000, 0x02aa0000, 0x02ab0000) to space 64K, 0% used [0x02ab0000, 0x02ab0000, 0x02ac0000) tenured generation total 4096K, used 0K [0x02ea0000, 0x032a0000, 0x069c0000) the space 4096K, 0% used [0x02ea0000, 0x02ea0000, 0x02ea0200, 0x032a0000) compacting perm gen total 12288K, used 2219K [0x069c0000, 0x075c0000, 0x0a9c0000) the space 12288K, 18% used [0x069c0000, 0x06bead18, 0x06beae00, 0x075c0000) No shared spaces configured.

我尝试添加 -Xmx 选项,但认为这可能不是解决方案。有什么建议吗?

提前致谢。

最佳答案

您的 JVM 崩溃了,-Xmx 将无济于事。您可以尝试使用 -Xint 运行并看看是否可以重现该问题吗?这将告诉 JVM 在没有热点的情况下运行,这意味着没有动态编译优化。您运行的是哪个版本的 JVM?如果您无法使用 -Xint 重现问题,并且您使用的是最新的 JVM,则可以尝试仅排除 magick.MagickImage.writeImage 进行编译。

要排除,请在应用程序工作目录中创建一个名为:

.hotspot_compiler 

并添加行:

exclude magick/MagickImage writeImage

关于java - JMagick 和 JVM 崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7364873/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com