Why Activity Monitor shows different memory usage of Java then Java running itself? -
so have code:
public class testclass { public static void main(string[] args) throws interruptedexception { runtime runtime = runtime.getruntime(); arraylist<integer> integers = new arraylist<integer>(); integers.ensurecapacity(integer.max_value/5); system.out.println(runtime.totalmemory()/1000000); thread.sleep(10000); } }
which prints out around 1975 me.
but @ same time watching activity monitor in mac os , says java process using 1.62gib
why difference?
your programm shows memory of jvm of little programm. other programms utilize own jvm, own memory. special native libraries opencl not total visualized.
for memory analyse please utilize java visualvm (jdk 1.7 or higher in ./bin (installation folder of java) or http://visualvm.java.net/ ). there concrete list of running jvms , memory-usage. can heap dump , look, how much memory used object.
java memory
No comments:
Post a Comment