Yesterday I had a problem with a containerized (Docker) Java Spring Boot application. When I'd tried to upload a 5000x5000 pixel image (about 5MB) I had an OOE (out of memory) error during the thumbnail generation.
So I increased the memory limit in this way
resources:
limits:
memory: 1024M
but has not been enough to solve. So after a little bit of searches I added this environment variable into the docker-compose.yml
JAVA_TOOL_OPTIONS: '-Xmx1024m'
and now it works.
My question is: JVM doesn't take all the memory allocated for the container specified in resource > memory > limit: 1024M?
Why is necessary to pass the -Xmx
parameter in order to increase the heap space?