I am running a java program that loads very large (almost 2Gb) files. It runs fine within Eclipse as long as I set the max heap space -mx3700m or higher. Eclipse executes with javaw, and when I watch the memory usage in Task Manager I can see the Private Working Set memory hitting around 3.7Gb.
The problem comes when I create a runnable jar and try to run from the command line. I've tried using both java and javaw, with max heap space all the way up to -mx7000m (my computer has 8Gb RAM). But I always run out of memory. When I monitor in Task Manager, the memory hits a ceiling at 2.08Gb and never goes beyond.
I'm using the same 64bit jre in both cases - 1.8.0_144.
I need to be able to run the jar file from the command line, but I'm not sure what I'm doing wrong. Any help would be very much appreciated. Thanks.
-Xmx3700m
, subtle difference to what you seem to have set. – Thomas Jungblut