# Date: 2019-02-01 16:54:55 +0000 (Fri, 01 Feb 2019)
#
# https://github.com/harisekhon/bash-tools
#
# License: see accompanying Hari Sekhon LICENSE file
#
# If you're using my code you're welcome to connect with me on LinkedIn and optionally send me feedback to help steer this or other code I publish
#
# https://www.linkedin.com/in/harisekhon
#
# Calculates the total combined RAM in MB allocated to all Java heap sizes on all JVM processes running on the local machine
#
# You should account for at least ~20% overhead on top of this to account for non-heap Java RAM usage eg. off-heap allocations, JIT optimizations, JNI code, GC (especially G1) etc...
#
# Sun JDK 8, OpenJDK 11 and IBM JDK all treat the last -Xmx on the command line as the actual one, so we are going with that
#
# You can check this is true on your specific implementation like so: