There is some useful info written here which since most people use Zulu some of what is written may not be accurate for zulu, but the discussion around xms and xmx is fine.
free -h in the terminal and check how much swap is used. If you are not using swap then your max heap space is fine if it also passes the test in point 2. Increasing the heap too much takes away ram from non Java apps and also cache. Cache is great as it may mean a SD card read is not needed as the file is already in ram. It also impacts the GC if you set it too big AND too small.
Look at what your current heap size grows and shrinks to, you only need to know a rough min and max value. If the min value is <15% of your xmx value, then you may want to consider dropping xmx down lower. This is due to GC reasons and your system can probably make good use of the ram for cache.
Make both xmx and xms the same value so the system does not keep resizing it which you will see this in the ‘committed heap size’ value if it keeps changing. It makes things simple to keep them the same, but you probably won’t notice either way.
If you press the up arrow on your keyboard it will re show the last command you used, so you can watch the values this way, or there are more advanced tools for watching the contents of the heap in real time which I often do to look for memory leaks. Everything that runs in java uses the heap (bindings, rules, the openhab backend and more) and everything outside of Java uses the ram that is left over.
I totally agree and when you have 4gb of ram it is FAR easier to find a value that works compared to a juggling act on a 1gb limited setup.
Sounds like that will be fine, but it would be interesting to know what range your heap size shrinks and grows between instead of a static known number from your pic. There is no perfect number, it is just you need to make sure you don’t run out of heap space and also don’t set it excessively high.