How can I get the memory that my Java program uses via Java’s Runtime api?
There are similar questions out there, but they seem to avoid answering this specific question. How can I get the memory that my Java program uses via Java’s Runtime api? The answer here indicates that I can do something like this: System.out.println(“KB: ” + (double) (Runtime.getRuntime().totalMemory() – Runtime.getRuntime().freeMemory()) / 1024); But this always returns the … Read more