我正在运行的hadoop程序中有明显的内存泄漏。具体来说,我得到消息:
超出了GC错误上限
随后是异常(exception)
attempt_201210041336_0765_m_0000000_1: Exception in thread "Tread for syncLogs" java.lang.OutOfMemoryError: GC overhead limit exceeded
attempt_201210041336_0765_m_0000000_1: at java.util.Vector.elements (Vector.java:292)
attempt_201210041336_0765_m_0000000_1: at org.apache.log4j.helpers.AppenderAtachableImpl.getAllAppenders(AppenderAttachableImpl.java:84
attempt_201210041336_0765_m_0000000_1: at org.apache.log4j.Category.getAllAppenders (Category.java:415)
attempt_201210041336_0765_m_0000000_1: at org.apache.hadoop.mapred.TaskLog.syncLogs(TaskLog.java:256)
attempt_201210041336_0765_m_0000000_1: at org.apache.hadoop.mapred.Child$3.run(Child.java:157)
我正在初步试验中使用很小的数据集运行,因此我不应该达到任何内存限制。更重要的是,我不想更改hadoop的配置。如果程序无法使用当前配置运行,则需要重写该程序。
谁能帮助我找出如何诊断此问题?是否有一个命令行参数来获取内存使用情况的堆栈跟踪?还有其他跟踪此问题的方式吗?
ps。我用手写错误消息,无法从存在问题的系统中复制粘贴。因此,请忽略任何错别字,因为这是我的愚蠢错误。
编辑:对此进行更新。我又做了几次工作;虽然我总是得到
超出错误GC开销限制
消息我并不总是获得log4j的stacktrace。因此问题可能不是log4j,而是由于其他原因导致内存不足,log4j发生了故障?
最佳答案
“超出了GC开销限制”可能意味着正在创建许多短寿命的对象,这超出了GC所能处理的时间,而又不占用总时间的98%。有关如何使用this question查找有问题的类和分配点的信息,请参见JProfiler。
免责声明:我的公司开发JProfiler。