You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can't run simple app on heroku due to memory calculator #2
On early versions I was able to run a simple spring boot app on Heroku's free tier suing paketo but now I get:
2020-08-14T20:23:31.670371+00:00 app[web.1]: required memory 819590K is greater than 512M available for allocation: -XX:MaxDirectMemorySize=10M, -Xmx400M, -XX:MaxMetaspaceSize=102790K, -XX:ReservedCodeCacheSize=240M, -Xss1M x 50 threads
Is there a way to disable the memory calculator and pass my own JVM memory settings?
You can set any valid JVM memory flag (the ones in the log message are the pertinent ones) and the calculator will take that setting into account when calculating the rest.
Note though, that your explicit setting of -Xmx400M plus the JVM's default ReservedCodeCache of 240Malready exceeds the container size of 512M. You can try to decrease the JVM's default configuration but doing so will result in a drastic performance penalty when the JIT is forced to evict earlier optimizations from the ReservedCodeCache. This also doesn't take into account the 50M for threads (50 threads * 1M stacks) or the ~100M of Metaspace.
It's important to remember that the memory calculator is designed to ensure that your application will never exceed the size of your container, even when it is fully utilized (full JIT cache, all threads running). Few, if any, JVM-based applications can achieve this in a 512M container without drastically changing the JVM's defaults.
Activity
nebhale commentedon Aug 26, 2020
You can set any valid JVM memory flag (the ones in the log message are the pertinent ones) and the calculator will take that setting into account when calculating the rest.
Note though, that your explicit setting of
-Xmx400Mplus the JVM's defaultReservedCodeCacheof240Malready exceeds the container size of512M. You can try to decrease the JVM's default configuration but doing so will result in a drastic performance penalty when the JIT is forced to evict earlier optimizations from theReservedCodeCache. This also doesn't take into account the50Mfor threads (50 threads *1Mstacks) or the ~100MofMetaspace.It's important to remember that the memory calculator is designed to ensure that your application will never exceed the size of your container, even when it is fully utilized (full JIT cache, all threads running). Few, if any, JVM-based applications can achieve this in a
512Mcontainer without drastically changing the JVM's defaults.jarias commentedon Aug 29, 2020
Thanks for the info, I know the risk of bad memory config, but is good to know I can still controll it at my own risk