我该怎么做才能解决这个OutOfMemoryError:Java堆空间:
17:29:23 ERROR pool-10-thread-2 storage.JCloudsStorageModule - Error on writing bucketIndex: 4167 and bucketOffset: 1044480
java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at org.jscsi.target.storage.JCloudsStorageModule.getAndprefetchBuckets(JCloudsStorageModule.java:275)
at org.jscsi.target.storage.JCloudsStorageModule.write(JCloudsStorageModule.java:318)
at org.jscsi.target.connection.stage.fullfeature.WriteStage.execute(WriteStage.java:223)
at org.jscsi.target.connection.phase.TargetFullFeaturePhase.execute(TargetFullFeaturePhase.java:197)
at org.jscsi.target.connection.Connection$TargetConnection.call(Connection.java:252)
at org.jscsi.target.connection.Connection$TargetConnection.call(Connection.java:77)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.OutOfMemoryError: Java heap space
at org.jscsi.target.storage.JCloudsStorageModule$ReadTask.call(JCloudsStorageModule.java:401)
at org.jscsi.target.storage.JCloudsStorageModule$ReadTask.call(JCloudsStorageModule.java:371)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
... 4 more
java.io.IOException: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
at org.jscsi.target.storage.JCloudsStorageModule.write(JCloudsStorageModule.java:328)
at org.jscsi.target.connection.stage.fullfeature.WriteStage.execute(WriteStage.java:223)
at org.jscsi.target.connection.phase.TargetFullFeaturePhase.execute(TargetFullFeaturePhase.java:197)
at org.jscsi.target.connection.Connection$TargetConnection.call(Connection.java:252)
at org.jscsi.target.connection.Connection$TargetConnection.call(Connection.java:77)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at org.jscsi.target.storage.JCloudsStorageModule.getAndprefetchBuckets(JCloudsStorageModule.java:275)
at org.jscsi.target.storage.JCloudsStorageModule.write(JCloudsStorageModule.java:318)
... 8 more
Caused by: java.lang.OutOfMemoryError: Java heap space
at org.jscsi.target.storage.JCloudsStorageModule$ReadTask.call(JCloudsStorageModule.java:401)
at org.jscsi.target.storage.JCloudsStorageModule$ReadTask.call(JCloudsStorageModule.java:371)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
... 4 more
我的代码使用CompletionService和ConcurrentHashMap。我在linux上用ext3格式化了一个带有jSCSI.org的iscsi驱动程序。奇怪的是,当我用ext4格式化时,它进展顺利且时间非常快。抛出错误的行是:byte [] returnval = startTask.get()。getValue();
提前致谢,费利佩
答案 0 :(得分:1)
只要泄漏的内存填满堆区域中的所有可用内存,并且垃圾回收无法清除它,就会抛出java.lang.OutOfMemoryError:Java heap space
错误。
尝试增加此类资源的可用性。当您的应用程序没有足够的Java堆空间内存来正常运行时,修复它就像更改JVM启动配置和添加(或增加(如果存在)以下内容一样简单:-Xmx1024m
或者您可以免费试用Plumbr。当我们找到java.lang.OutOfMemoryError
的原因时,您会看到问题的确切位置以及解决方案指南。
答案 1 :(得分:0)