adding protection from going over total memory on a host with xmx and xms settings'