R错误:java.lang.OutOfMemoryError:Java堆空间 [英] R Error: java.lang.OutOfMemoryError: Java heap space

查看:886
本文介绍了R错误:java.lang.OutOfMemoryError:Java堆空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将R连接到Teradata以将数据直接拉入R进行分析。但是,我得到的错误是:

I am trying to connect R to Teradata to pull data directly into R for analysis. However, I am getting the error of:

Error in .jcall(rp, "I", "fetch", stride, block) :
  java.lang.OutOfMemoryError: Java heap space

我试过设置我的R选项通过执行以下操作来增加JVM的最大堆大小:

I have tried to set up my R options to increase the max heap size of JVM by doing:

options(java.parameters = "-Xmx8g")

我还试图用rJava函数初始化java参数 .jinit as: .jinit(parameters = - Xmx8g)
但仍然失败。

I have also tried to initialize java parameters with rJava function .jinit as: .jinit(parameters="-Xmx8g"). But still failed.

计算出的数据大小应约为3G(实际上小于3G)。

The calculated size of the data should be approximately 3G (actually less than 3G).

有人可以帮我吗?任何建议都表示赞赏。

Could anyone help me on this? Any advice is appreciated.

推荐答案

您需要确保在加载之前分配额外的内存 rJava或任何其他包。首先擦除环境(通过 rm(list = ls())),如果必须,重新启动R / Rstudio,并修改脚本开头的选项。

You need to make sure you're allocating additional memory before loading rJava or any other packages. Wipe the environment first (via rm(list = ls())), restart R/Rstudio if you must, and modify the options at the beginning of your script.

options(java.parameters = - Xmx8000m)

参见例如 https://support.snowflake.net/s/article/solution-using-r-the-following-error-is-returned-javalangoutofmemoryerror-gc-overhead-limit-exceeded

这篇关于R错误:java.lang.OutOfMemoryError:Java堆空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆