JProfiler:查找内存泄漏引用名称
我正在尝试将 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++;
}
}
}
现在,当我使用本地运行的配置文件 Web 应用程序在此应用程序上运行 JProfiler 时。 它给了我这样的看法。请在此处查看屏幕截图
http://tinypic.com/view.php?pic =2r5c2nq&s=7
我有这些问题:
它显示正在创建的字符串对象的数量。 (但是我们如何知道哪个类/servlet 以及哪个字符串实际上负责对象的创建,因为我们在应用程序中可能有许多字符串。)??
为什么“开始”按钮(我突出显示的)被禁用?
通过单击启动按钮启动 JProfiler 就足够了(请看该图片),我们不需要启动 Tomcat 服务器吗??
请帮忙。谢谢 。
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 :
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 ??
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 .
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为此,您必须使用堆遍历器。动态内存视图无法显示有关引用的任何信息,因为必须创建快照。
请参阅此屏幕截图 有关如何使用 JProfiler 查找内存泄漏的更多信息。
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.