Fix memory limit autodetection (for various settings) returning -1 (=infinite) if over 2GB.