简体   繁体   English

jvm 创建堆转储但没有超出 memory

[英]jvm create heap dump but without out of memory

I have already added JVM args: -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=C:\Temp Sometimes after I saw JVM created heapdump file but there is no OutOfMemoryError reported in the application error.log file.我已经添加了 JVM 参数:-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=C:\Temp 有时我看到 JVM 创建了 heapdump 文件但没有 OutOfMemoryError 文件在应用程序日志中报告。 My question how is it possible that JVM creates heap dump file without throwing any error.我的问题是 JVM 如何创建堆转储文件而不抛出任何错误。 It could be a problem with Application (AEM) or JVM?可能是应用程序 (AEM) 或 JVM 的问题?

If your application runs out of memory it is hard to tell exactly what will happen.如果您的应用程序用完 memory,则很难确切地说会发生什么。

If my understanding is correct then the following might have happened: While your Java application was running at some point one of the Threads might have triggered an OutOfMemoryError.如果我的理解是正确的,那么可能会发生以下情况:当您的 Java 应用程序正在运行时,其中一个线程可能触发了 OutOfMemoryError。

If this application has no catch statement (for either OutOfMemoryError, Error, Throwable) or some other mechanism like: https://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#setDefaultUncaughtExceptionHandler(java.lang.Thread.UncaughtExceptionHandler) that logs to your application logfile you might not see it.如果此应用程序没有 catch 语句(对于 OutOfMemoryError、Error、Throwable)或其他一些机制,例如: https://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#setDefaultUncaughtExceptionHandler( java.lang.Thread.UncaughtExceptionHandler)记录到您的应用程序日志文件,您可能看不到它。

It can however be that some information was printed to either stdout / stderr which may (or may not) have been redirected to some other file.但是,可能某些信息已打印到 stdout / stderr 可能(或可能不会)已重定向到其他文件。

To increase the chance of that happening you might want to use something like: -XX:+CrashOnOutOfMemoryError that will print the cause even if the application does not log it.为了增加发生这种情况的机会,您可能需要使用类似: -XX:+CrashOnOutOfMemoryError的东西,即使应用程序没有记录它也会打印原因。 See for more info or other options: https://dzone.com/articles/outofmemoryerror-related-jvm-arguments有关更多信息或其他选项,请参阅: https://dzone.com/articles/outofmemoryerror-related-jvm-arguments

Even more useful might be to log the activity and statistics of the Garbage Collector and analyze it.更有用的可能是记录垃圾收集器的活动和统计数据并对其进行分析。 See: How to enable Java GC Logging?请参阅:如何启用 Java GC 日志记录? on https://gceasy.io/https://gceasy.io/

Those options are only relevant to the JVM and are not application-specific.这些选项仅与 JVM 相关,并非特定于应用。 It's unlikely to be anything related to AEM.它不太可能与 AEM 相关。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM