JProfiler:查找内存泄漏引用名称 [英] JProfiler : Finding the Memory leak reference name

查看:41
本文介绍了JProfiler:查找内存泄漏引用名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 JProfiler 用于我在 tomcat 服务器下运行的应用程序之一.

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

所以我写了一个内存泄漏servlet,如下所示.

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++;
    }
}
}

现在,当我使用本地运行的 Profile Web 应用程序在此应用程序上运行 JProfiler 时.它给了我这个观点.请在此处查看屏幕截图

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

我有这些问题:

  1. 它显示正在创建的字符串对象的数量.(但是我们如何知道在哪个类/servlet 中以及究竟哪个字符串实际上负责创建对象,因为我们在一个应用程序中可能有许多字符串.)??

  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. ) ??

为什么开始按钮(我高亮显示)被禁用??

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

点击启动按钮启动 JProfiler 就足够了(请看那个图片),我们不需要也启动 Tomcat 服务器吗??

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 ??

请帮忙.谢谢你 .

推荐答案

为此,您必须使用堆遍历器.动态内存视图无法显示有关引用的任何信息,因为必须创建快照.

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.

请参阅此屏幕转换以获取有关如何使用 JProfiler 查找内存泄漏的更多信息.

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

这篇关于JProfiler:查找内存泄漏引用名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆