2013年10月11日星期五

Monitor a running program , which has a java object , how to view real-time changes in the object's memory

Player play = new Player ();
Player play2 = new Player ();
while (true) {
play.playGames ();
play2.playGames ();
}

How to view play objects and play2 object to run two hours in the case of memory , the peak of what , what's simple and easy to use tool please tell us , or where there is any way please say next
---- - Solution --------------------------------------------
JDK comes jconsole.exe or jvisualvm.exe
------ Solution ----------------------------- ---------------
seemingly is also a world-class problem . . .

check out you will find the largest memory footprint are byte [] or char [] such as tool does not do relationships based on object contains the cumulative operation .

So, if the object structure is relatively simple if so, would like to ascertain its memory footprint , it can be directly object serialization , so you can know roughly the size of its memory footprint . However, if the object is complex , and even what 's involved in peripheral resources , it lacks understanding.
------ Solution ---------------------------------------- ----
jprofiler very good use, you can try
------ For reference only --------------------- ------------------
jconsole.exe this tool I used, but only able to monitor the perimeter of the class , as I wrote the above code is placed in the Test class only monitoring Test, Test Player class which contains not know how to monitor the
------ For reference only --------------------- ------------------
btrace this tool is also good , jconsole, jvisualvm these two although easy to use, but it is always a little something

没有评论:

发表评论