0

I have a spring boot application that can run out of memory when processing very large uploaded files. I'm encountering this when running ./gradlew bootRun and using embedded tomcat.

Is there a gradle option or some other configuration I can set in a TomcatEmbeddedServletContainerFactory to set the maximum memory allowed for the spring boot application? I'd like to have something in a configuration file or the build.gradle file itself, so it would work for all developers.

I've tried setting org.gradle.jvmargs=-Xmx12000m in gradle.properties, but seems to have no effect.

2
  • -Xmx is not an option? Commented Dec 4, 2017 at 13:31
  • I've tried setting it in gradle.properties (see edit), but maybe I'm not doing it right. Commented Dec 4, 2017 at 13:41

1 Answer 1

1
  • There are a few Gradle properties that can speed up your builds a bit.

     org.gradle.parallel=true
     org.gradle.daemon=true
     org.gradle.jvmargs=-Xms256m -Xmx1024m
    
  • If you want to add more memory to your tomcat you should change the following lines in setenv.sh script on your tomcat directory under bin/:

    export CATALINA_OPTS="$CATALINA_OPTS -Xms512m"
    export CATALINA_OPTS="$CATALINA_OPTS -Xmx8192m"
    export CATALINA_OPTS="$CATALINA_OPTS -XX:MaxPermSize=256m"
    
Sign up to request clarification or add additional context in comments.

2 Comments

(before your edit) OK, that I think is parsing it, becuase i'm getting a build error indicating that it's an invalid maximum heap size, for everything I try
Do I need quotes around the args or not? And, I believe I need more than 1024 megs, given then large files i'm uploading.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.