0

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

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

@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 时。它给了我这样的看法。请在此处查看屏幕截图

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

我有这些问题:

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

  2. 为什么开始按钮(我突出显示)被禁用?

  3. 通过单击启动按钮启动 JProfiler 就足够了(请参阅该图像),我们是否还需要启动 Tomcat 服务器?

请帮忙 。谢谢你 。

4

1 回答 1

2

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

有关如何使用 JProfiler 查找内存泄漏的更多信息,请参阅此屏幕截图。

于 2011-10-23T07:58:36.667 回答