I am running Spark application using spark-submit and defined JVM parameters. With this set of parameters I get java heap space error:
EXTRA_JVM_FLAGS="-server -XX:+UseG1GC
-XX:ReservedCodeCacheSize=384m
-XX:MaxDirectMemorySize=2G
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
--master "local[4]"
--driver-memory 2G
--driver-java-options "${EXTRA_JVM_FLAGS}"
I tried to increase driver memory but it caused JVM crash. Also, I tried to increase max direct memory size which did not help in any way. What options should I change to fix heap space error?