简体   繁体   中英

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. I am using some custom tag handlers to display data on a JSP page which constantly giving me heap size (out of memory) error.

I am using Netbeans 7.1 as development IDE, I tried to put -Xms256m -Xmx256m in VM option under project properties run option. I am not sure whether it is increasing heap size or not, Is there any way to find out present heap size of 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的一些信息。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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