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

Out of memory when saving large mapping object #290

Open
MaximMoinat opened this issue Mar 2, 2021 · 4 comments
Open

Out of memory when saving large mapping object #290

MaximMoinat opened this issue Mar 2, 2021 · 4 comments
Labels
bug Rabbit-In-A-Hat Issue concerning the specification of mapping rules

Comments

@MaximMoinat
Copy link
Collaborator

And som other warnings about illegal operations:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.cedarsoftware.util.io.MetaUtils (file:/Users/maxim/Develop/OHDSI/WhiteRabbit/release_zips/WhiteRabbit_v0.10.3/repo/com/cedarsoftware/json-io/3.0.1/json-io-3.0.1.jar) to field java.lang.Boolean.value
WARNING: Please consider reporting this to the maintainers of com.cedarsoftware.util.io.MetaUtils
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
@MaximMoinat MaximMoinat added bug Rabbit-In-A-Hat Issue concerning the specification of mapping rules labels Mar 2, 2021
@MaximMoinat
Copy link
Collaborator Author

A quick solution is to increase the amount of memory assigned when running the jar:
In a text editor, open rabbitInAHat.sh (Mac) or rabbitInAHat.bat (Windows) and change the -Xmx option to a larger value. By default this is 1200m, and for me the issue was fixed when increasing this to -Xmx2400m.

exec "$JAVACMD" $JAVA_OPTS -Xmx2400m \
  -classpath "$CLASSPATH" \
  -Dapp.name="rabbitInAHat" \
  -Dapp.pid="$$" \
  -Dapp.repo="$REPO" \
  -Dapp.home="$BASEDIR" \
  -Dbasedir="$BASEDIR" \
  org.ohdsi.rabbitInAHat.RabbitInAHatMain \
  "$@"

@blootsvoets
Copy link
Collaborator

The warning is unrelated. Java 11 only warns on certain reflective operations (e.g., changing a private method to public at runtime). In a future Java version, it might prohibit those operations. Sometimes a later version of the library (in this case, json-io) will have fixed the access.

@blootsvoets
Copy link
Collaborator

Can you pinpoint in code where the large object is written? It may help to write the object in streaming style rather than collecting the whole dataset in a single object and then write it to disk.

@MaximMoinat
Copy link
Collaborator Author

MaximMoinat commented Mar 2, 2021

@blootsvoets The out of memory error is thrown upon creating a string object (json representation of the model).

public String toJson() {
return JsonWriter.formatJson(JsonWriter.objectToJson(this));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Rabbit-In-A-Hat Issue concerning the specification of mapping rules
Projects
None yet
Development

No branches or pull requests

2 participants