Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java heap space error #91

Open
Angie891 opened this issue Mar 30, 2023 · 3 comments
Open

java heap space error #91

Angie891 opened this issue Mar 30, 2023 · 3 comments

Comments

@Angie891
Copy link

Hello,

while using the loadGridData function, I get following error:

[2023-03-30 13:53:33] Retrieving data subset ...
Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, :
java.lang.OutOfMemoryError: Java heap space
Calls: loadGridData ... array -> -> .jrcall -> .jcall -> .jcheck

I tried same code on two different machines, windows and linux, with different files.

On linux, I tried to read nc file of size 4.8GB (25 years of daily data) on a machine that has java heap size assigned to 27.8GB, and it gave me above error.

Then I tried same code with smaller files (~700MB) on a windows machine that has java heap size assigned to 13GB, and it can read only one file. If I try to read two files in a row, I get same error above. (if I use gc() between the files, it reads files with no issues)

It seems that loadGridData requires java heap space size rougly 10 times higher than the file size it is reading, which makes it quite hard to use with bigger files.

Given I am doing quantile mapping, the results will differ whether I do it on whole period or just on part of the period, so I am wondering is there any solution for this~ Thanks in advance!

@durutti
Copy link

durutti commented Apr 10, 2023

I had the same issue with files about 7gb
the following command before calling loadeR solved the issue for me
options(java.parameters = "-Xmx10g")

@Angie891
Copy link
Author

My memory was set to 27.8GB. I finally solved the issue by talking to system admin and adjusting java heap size to 100GB on the linux system - options(java.parameters = "-Xmx60g") still gave me same error, 80Gb or 100GB works!! I don't understand why it needs SO much memory, but for some reason it does :/

@QuocPhamBao
Copy link

I got the same issue, anybody had solution for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants