Simple Java program consumes huge amount of memory

171 Views Asked by At

The following simple program consumes about 800-900 MB RAM on my company computer and also on other company computers. I tried different java versions like 1.8.0_331 or AdoptOpenJDK11. When I start notepad.exe instead of cmd.exe the program consumes only a few MB. Visual VM profiler says that there is heap size about 500MB and used heap about 13MB. On my private computer I can't reproduce this issue.


public class Test {

    public static void main(String[] args) throws IOException, InterruptedException {
        Process p = Runtime.getRuntime().exec("cmd.exe");
        p.waitFor();
    }
}
0

There are 0 best solutions below