I have been unable to execute Java with >=2048M memory allocation since
upgrading to stretch. I've changed nothing in my configuration otherwise.
I have plenty of RAM:
# free
total used free shared buff/cache
available
Mem: 5168396 3326140 245712 85320 1596544 1227812
Swap: 2255616 259204 1996412
# ulimit -v
unlimited
# java -Xmx2048M
Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap
# ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 45 Jun 27 20:45 /etc/alternatives/java ->
/usr/lib/jvm/java-8-openjdk-i386/jre/bin/java
But the same problem occurs when I switch to other Java alternatives.
(openjdk-8-jre version = 8u131-b11-2).
Interestingly, if I set ulimit -v to something other than 'unlimited'
but higher than the amount requested for the java process, it works:
# ulimit -v 2097153
# java -Xmx2048M
(no errors)
But shouldn't "unlimited" be higher than any arbitrary value I put
there? Also, for Java programs that are run as daemons from /etc/init.d,
I have been unable to figure out how to get the arbitrary ulimit -v
setting to "stick".
TIA for any suggestions for how to fix or troubleshoot.