0

I want to increase the permgen memory and Heap Memory for my Tomcat instance. I have tried by creating the setenv.bat file. Now I am not sure whether it is reflected or not.

Could you please tell me how to know the existing allocated Heap and PerGen memory for Tomcat instance and how to cross check whether the memory is increased or not.

I have tried this method mentioned in the url but this is for JAVA in the windows not for specific to any java instance https://www.mkyong.com/java/find-out-your-java-heap-memory-size/

anudeep
  • 11
  • 2

1 Answers1

0

Solution 1: Check windows process parameters

You might see it in the task manager by enabling the command line column and check if java.exe was indeed started with the -XX:MaxPermSize parameter.

However the task manager does not always show the full command line. It cuts off after a certain number of characters. You can use Process Explorer to see the full command line (just mouse over the java.exe process).

Solution 2: Check in code:

import java.lang.management.ManagementFactory;
import java.lang.management.MemoryPoolMXBean;
import java.lang.management.MemoryType;
import java.lang.management.MemoryUsage;

for (MemoryPoolMXBean mpBean : ManagementFactory.getMemoryPoolMXBeans()) {
    System.out.printf(
            "Type: %s, Name: %s: %s\n",
            mpBean.getType().toString(), mpBean.getName(), mpBean.getUsage()
    );
}

See also How is the java memory pool divided.

Community
  • 1
  • 1
nharrer
  • 618
  • 7
  • 21