Running really low-memory java on cloudfoundry

With java-buildpack-3.3 a memory controller is added with these defaults:

To run a java cloudfoundry container with 32 MB first configure your app with the scale command:
cf scale APP -m 32m.

Then add an config environment variable used by the java-buildpack, see also here.

cf set-env APP JBP_CONFIG_OPEN_JDK_JRE '[memory_calculator: {memory_sizes: {metaspace: 12m, heap: 16m, stack: 1m }, memory_initials: {heap: 10%, metaspace: 10% }} ]'

And another tipp: Don’t use ranges in above memory_sizes config, as the calculation of the memory is really, really strange.

memory weightings (in the config it’s called „memory_heuristics“ and mimic a percent value!) are the first step in calculating the memory size for each memory type, e.g. metaspace, heap, etc… – only when the calculated memory of the memory weightings are below the value of the memory_sizes values, the memory_sizes value is actually used. WTF?!

With above config I was able to run a java program with 32m, which is still very high. but I need to check this again.

requested state: started
instances: 1/1
usage: 32M x 1 instances
urls: xxx
package uploaded: Sat Nov 28 15:47:38 UTC 2015
stack: cflinuxfs2
buildpack: java_buildpack

     state     since                    cpu    memory         disk           details   
#0   running   2015-11-28 07:50:12 PM   0.1%   31.6M of 32M   123.6M of 1G