JAVA

[OOM] Out Of Memory 분석 방법(with JProfiler(유료))

내나위 2024. 9. 22. 18:20
728x90
반응형
SMALL
  • 시스템 성능, 메모리 사용량, 잠재적 인 메모리 누수 및 스레드 프로파일 링을 볼 수 있는 인터페이스를 제공
  • 로컬 및 원격 응용 프로그램 모두에 사용
  • 원격 컴퓨터에서 실행중인 Java 응용 프로그램을 설치할 필요없이 프로필 작성
  • 코드 일부 수정(이유: 실행 즉시 dump 파일 생성으로 온라인 연결 불가)
import java.util.ArrayList;
import java.util.List;
 
public class OutOfMemoryExample {
    public static void main(String[] args) {
        List<Object> memoryLeak = new ArrayList<>();
        try {
            while (true) {
                // Create multiple objects in each loop iteration to increase memory usage
                for (int i = 0; i < 1000; i++) {
                    memoryLeak.add(new Object());
                }
                Thread.sleep(100); // Delay to allow monitoring
            }
        } catch (OutOfMemoryError e) {
            System.out.println("Out of memory!");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

 

1. 다운로드

 

JProfiler

성능 병목 현상을 제거하기 위해 J2SE 및 J2EE 애플리케이션 프로파일링

jprofiler.softonic.kr

2. 온라인 프로파일링

  • 어플리케이션 실행 후 Jprofiler > Start Center 클릭
  • Start 클릭시 온라인 프로파일링을 할수 있고 Heap Dump Only 클릭시 Dump 파일 생성을 할 수 있다

  • Start 클릭 후 온라인 프로파일링 화면

 

  • Heap Walker에서는 힙 스냅샷 정보를 확인

728x90
반응형
LIST

'JAVA' 카테고리의 다른 글

[JVM] Java Virtual Machine  (0) 2024.09.22
[OOM] Out Of Memory 분석 방법(with VisualVM)  (0) 2024.09.22
[OOM] Out Of Memory 분석 방법(with MAT)  (0) 2024.09.20