Permgen Space 사용량을 프로그래밍 방식으로 찾으려면 어떻게해야합니까?
-
22-08-2019 - |
문제
진단하려고합니다 java.lang.OutOfMemoryError: PermGen Space
Sun의 핫스팟 JVM에서 실행할 때의 오류이며, 내 프로그램이 다양한 지점에서 얼마나 많은 Permgen 공간을 사용하고 있는지 알고 싶습니다. 이 정보를 프로그래밍 방식으로 찾는 방법이 있습니까?
해결책
다음과 같은 것을 사용할 수 있습니다.
Iterator<MemoryPoolMXBean> iter = ManagementFactory.getMemoryPoolMXBeans().iterator();
while (iter.hasNext())
{
MemoryPoolMXBean item = iter.next();
String name = item.getName();
MemoryType type = item.getType();
MemoryUsage usage = item.getUsage();
MemoryUsage peak = item.getPeakUsage();
MemoryUsage collections = item.getCollectionUsage();
}
이것은 모든 유형의 메모리를 제공합니다. "Perm Gen"유형에 관심이 있습니다.
다른 팁
제휴하지 않습니다 StackOverflow