Measure runtime memory used by your code:
//Start------
-------
YourAPIClass object=new YourAPIClass();
Runtime runtime = Runtime.getRuntime();
object.someMethod()//call your api methods whose memory usage u want to know
runtime.gc(); // Run garbage collector
long usedMemory = runtime.totalMemory() - runtime.freeMemory(); // Used memory Evaluation In bytes
System.out.println("Memory used by someMetod is = " usedMemory +" bytes");
--------
--------
//end
No comments:
Post a Comment