简体   繁体   English

netbeans中的Tomcat堆大小增加以及如何查找当前堆大小

[英]Tomcat heap size increase in netbeans and how to find current heap size

I am using tomcat 7 on windows 7 SP1 with 3GB RAM. 我在带有3GB RAM的Windows 7 SP1上使用tomcat 7。 I am using some custom tag handlers to display data on a JSP page which constantly giving me heap size (out of memory) error. 我正在使用一些自定义标记处理程序在JSP页面上显示数据,该页面不断给出堆大小(内存不足)错误。

I am using Netbeans 7.1 as development IDE, I tried to put -Xms256m -Xmx256m in VM option under project properties run option. 我使用Netbeans 7.1作为开发IDE,我试图在项目属性运行选项下的VM选项中放置-Xms256m -Xmx256m。 I am not sure whether it is increasing heap size or not, Is there any way to find out present heap size of tomcat? 我不确定它是否正在增加堆大小, 有没有办法找出tomcat的当前堆大小?

Or I need to do something else for increasing heap size? 或者我需要做一些其他事情来增加堆大小? Because of no clue to find whether it is increasing heap size or not, I am not able to debug where the problem is, with low heap size or something with my code. 由于无法发现是否增加堆大小,我无法调试问题所在,堆密度较小或代码有问题。

public static String heapMemUsage() 
{
    long used = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed();
    long max = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getMax();
    return ""+used+" of "+max+" ("+ used/(double)max*100.0 + "%)";
}

您可以使用VisualVM之类的工具来获取有关运行VM的一些信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM