java - 尝试将大量数据行从文件写入corda时出现内存不足异常
问题描述
我需要将发送的数据注册表文件写入corda。我在“流”中调用“调用”方法。第一行是正常写的。
当我尝试在corda中写入大量数据行时发生错误:
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "FiberTimedScheduler-default-fiber-pool"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "FiberTimedScheduler-Same thread scheduler"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "rpc-server-reaper-0"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "RxIoScheduler-1 (Evictor)"
Exception in thread "Timer-0" java.lang.OutOfMemoryError: Java heap space
Exception in thread "server-timer" java.lang.OutOfMemoryError: Java heap space
Exception in thread "threadDeathWatcher-3-1" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-1 (activemq-netty-threads)" java.lang.OutOfMemoryError: Java heap space
Exception in thread "RxIoScheduler-2" java.lang.IllegalStateException: Fatal Exception thrown on Scheduler.Worker thread.
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:59)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-6" java.lang.OutOfMemoryError: Java heap space
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "MVStore background writer nio:C:/Users/Evsin/Desktop/CordaProjectV2/build/nodes/PartyA/persistence.mv.db"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-0 (ActiveMQ-scheduled-threads)"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-1 (ActiveMQ-scheduled-threads)"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-4 (ActiveMQ-scheduled-threads)"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "activemq-failure-check-thread"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-1 (ActiveMQ-client-netty-threads)"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-2 (activemq-netty-threads)"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-3 (activemq-netty-threads)"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-0 (activemq-netty-threads)"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-1 (activemq-netty-threads)"
Exception in thread "Thread-3 (ActiveMQ-client-netty-threads)" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-2 (activemq-netty-threads)" java.lang.OutOfMemoryError: Java heap space
解决方案
此问题很可能是由堆大小不足引起的。默认情况下,Corda 节点以 512MB 的 Java 堆大小开始。
-Xmx
您可以在启动节点时使用命令行参数来增加节点可用的 Java 堆内存量。例如,以下将运行堆大小为 2048MB 的节点:
java -Xmx2048m -jar corda.jar
推荐阅读
- java - 在 Java 中连接到 MongoDB
- python - 在 Python 中缩短条件
- excel - How to write formula to display how many times one word is present in a row in ratio?
- javascript - 由用户输入从下拉选项框中添加和删除
- c++ - 使用 C++ 在 Visual Studio 2017 中“项目引用”有什么作用?
- c# - C#中的多个通配符
- qt - QT 框架安装程序 - 如何强制 targetDir
- javascript - 在 html 代码中添加字符串变量
- r - 为 selectInput R Shiny 中的每个选定选项传递多个值
- javascript - 为什么函数长度不包括其余参数