본문 바로가기

SW Programming/JAVA5

NativeMemoryTracking, JAVA에서 네이티브 메모리 확인하고 싶을 때 JNI를 사용하면 NativeMemory 관리도 중요하다는 알아가고있다... Heap memory는 비교적 Jvm monitor 같은 툴을 이용해서 쉽게 접근했었는데, NativeMemory를 확인하는 것은 상대적으로 조금 불편해서 기록하고자 한다. JCMD를 이용해서 분석해야한다. 1. JAVA 실행 옵션추가(이클립스의 경우 VM arguments를 수정하면 된다) -XX:NativeMemoryTracking=summary 2. 메모리 사용 현황 베이스 라인 지정 >jcmd {pid} VM.native_memory baseline 3. 메모리 사용 현황 보기 >jcmd {pid} VM.native_memory summary.diff 참고 https://www.javacodegeeks.com/2016/0.. 2021. 5. 14.
JVM에서 동작하는 SW 정보 보고싶을때... VisualVM 메모리 누수 확인하고 싶다... out of memory 몇 번 만나고 나니 메모리 관리가 필요하다는 걸 느끼고 툴을 찾다가 이클립스에서 JVM monitor 라는 것이 존재하기는 하지만 나는 그것보다 Visual VM 이 더 직관적이고 object 검색도 편했다. cpu, memory classes, Threads 등 확인 가능하고 heapdump, sanpshot 제공한다. 오브젝트 단위로 size나 instance 확인할 수 있어서 좋다. * JDK설치했다면 jdk/bin 하위에 jvisualvm.exe 파일이 존재한다. VisualVM은 자바 기반의 애플리케이션이 자바 가상머신(JVM)에서 동작하는 과정에서 세부적인 정보를 보여주기 위한 시각화된 인터페이스를 제공하는 툴이다. VisualVM은 자.. 2020. 12. 8.
IOConsole.setWaterMarks 로 글자수 만큼만 콘솔 관리하기 void org.eclipse.ui.console.IOConsole.setWaterMarks(int low, int high) Sets the text buffer size for this console. The high water mark indicates the maximum number of characters stored in the buffer. The low water mark indicates the number of characters remaining in the buffer when the high water mark is exceeded. Parameters:low the number of characters remaining in the buffer when the high wate.. 2020. 11. 6.
(가독성 높히자)JAVA Modifier 순서, Access Modifier 등 The Java Language Specification recommends listing modifiers in the following order:Java 언어 사양에서는 다음 순서로 수정자를 나열 할 것을 권장합니다.1. Annotations2. public3. protected4. private5. abstract6. static7. final8. transient9. volatile10. synchronized11. native12. strictfp 이 규칙을 따르지 않으면 기술적 인 영향은 없지만 대부분의 개발자가 표준 순서에 익숙하기 때문에 코드의 가독성이 떨어집니다. Modifier수정자가 암시적일 때 작성하지 않아야합니다. 예를 들어 인터페이스 메소드는 public 이나 abstract .. 2020. 10. 27.
(JAVA) Resources should be closed. /"close()" calls should not be redundant. java static tool- SonarLint 사용하면서 만난 규칙들 Resources should be closed (java:S2095) Connections, streams, files, and other classes that implement the Closeable interface or its super-interface, AutoCloseable, needs to be closed after use. Further, that close call must be made in a finally block otherwise an exception could keep the call from being made. Preferably, when class implements AutoCloseab.. 2020. 10. 5.