JProfiler : Finding the Memory leak reference name

≡放荡痞女 提交于 2019-12-25 00:19:38

问题


I am trying to use JProfiler for one of my Application which is running under tomcat server .

So i wrote a memory leak servlet as shown below .

@SuppressWarnings(value = { "" })
public class Dust extends HttpServlet {
protected void doGet(HttpServletRequest request,
        HttpServletResponse response) throws ServletException, IOException {
    String str = new String();
    List myarrylist = new ArrayList();
    int i = 10;
        while (true) {
    myarrylist.add(str);
    System.out.println(i);
        i++;
    }
}
}

Now When i ran JProfiler on this Application using the Profile Web Application running locally . It gave me this view . please see the screen shot here

http://tinypic.com/view.php?pic=2r5c2nq&s=7

I have these questions :

  1. It shows that number of String Objects are being created . (But how can we know in what class / servlet and exactly which string is actually responsible for this creation of objects , as we may have many Strings in a Application. ) ??

  2. And why the Start Button ( which i highlited) is being disabled ??

  3. Is starting JProfiler is sufficient by clicking on the start Button ( Please see that image ) , nd dont we need to start the Tomcat server also ??

Please help . Thank you .


回答1:


You have to use the heap walker for that. The dynamic memory views cannot show any information about references because a snapshot has to be created.

Please see this screen cast for more information on how to find a memory leak with JProfiler.



来源:https://stackoverflow.com/questions/7862991/jprofiler-finding-the-memory-leak-reference-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!