728x90

 


JDK

JDK
JRE + javac, jar, debugging tools, javap
JVM + java, javaw, lib, rt.jar
Class Loader
Execution Engine
Runtime Data Area

 
Interpreter JIT Compiler Garbage
Collector

Java Source(.java) 

-(javac,자바컴파일러)-> Java Byte Code(.class)

-(ClassLoader, JVM 동적으로 클래스로딩)-> JVM 이동

1. (Interpreter)-> 바이트코드 읽고 요청내용 실행

2. (JIT Compiler)-> 기계어 변환후 실행


JVM

= ClassLoader + Execution Engine(Interpreter+JIT Compiler+GC) + Runtime Data Area

Runtime Data Area (JVM Memory)
JVM Language Stack


Heap Space
Method Area
Native Method Stack
PC Register
Young Generation
Old Generation
Permanent Generation
-> Metaspace(JDK1.8)

Code Cashe 
Eden
To Survivor Virtual
Old
Virtual
Runtime Constant Pool
Virtual Thread
1~N


Compile Native Virtual
From Survivor Field & Method Data
  Code

1. JVM Language Stack

: Last In First Out :LIFO , 메서드 호출 시마다 스택프레임 생성 수행후 삭제 , 메서드 안에서 사용되어지는 값(매개변수, 지역변수, 리턴값, 연산시 일어나는임시값)

2. Heap Space

-Xms                    최소 Heap 공간(Eden +Survivor+Old)
-Xmx                    최대 Heap 공간(Eden +Survivor+Old + Virtual)
+ Xms, Xmx 동일하게 셋팅  메모리 추가할당 시 WAS ms 정도 멈춤현상 주의

Young Generation : Minor GC 발생

Eden : 새로 생성된 대부분의 객체가 처음 위치하는 영역, GC 발생후 살아남은 객체는 Survivor1 or Survivor2이동

Survivor1,  Survivor2 : 둘중 하나의 영역이 꽉차면 참조없는 객체삭제, 살아남은 객체가 비워진 다른 Suvivor 영역이동

-XX:NewSize          최소 Young 공간 (Eden + Survivor)
-XX:MaxNewSize    최대 Young 공간 (Eden + Survivor + Virtual)
-XX:SurvivorRatio   Eden(new)/Survivor  영역 비율
-XX:NewRatio        Young(Eden + Survivor)/Old 

Old Generation : Major GC(Full GC) 발생

Old : Survivor에서 살아남은 객체만이 Old 영역이동, Old영역은 Young영역보다 크게 할당

3. Method Area = Class Area = Code Area = Static Area

Permanent :  Runtime Constant Pool + Field & Method Data + Code

             클래스, 인터페이스에 대한 런타임상수, 멤버변수(필드), 클래스변수(**Static), 생성자 메서드 저장

              *Java8에서 Metaspace 영역으로 교체 OutOfMemoryError 이슈

-XX:PermSize         초기 Perm size
-XX:MaxPermSize   최대 Perm size
+ 1.8 에서는 무시 Metaspace 대체 힙 메모리 일부
-XX:MaxMetaspaceSize

4. Native Area

Code Cashe  :  JIT방식: Just In Time  : Java -> ByteCode-> 기계어

                  변환 시간 절약위해 많이 쓰는 코드 기계어로 변환시켜 저장해둠

5. PC Register

현재 수행중인 JVM 명령과 주소 저장, CPU내의 기억장치, Thread가 생성될 떄 마다 생성

(이부분은 정확하지 않음 팁 소스에 따라 다르니.. 긇어모음)
최대 할당메모리  Xmx + MaxPermSize
Full GC 시간을 줄이는게 중요, 큰 요구사항없다면  Heap Size 1G
ex)
-Xmx1024m –Xms1024m -XX:MaxNewSize=384m -XX:MaxPermSize=128m 
>>전체  1024+138+300~500  : 1.5G
New : Old 비율은 서버 어플리케이션 1:2 적당  >> MaxNewSize = Xmx / 3
Perm 128M 적당, 256M을 대부분 넘지 않음

출처

tcpschool.com/java/java_intro_programming >> 자바프로그램 실행과정

epthffh.tistory.com/entry/JVM-%EB%A9%94%EB%AA%A8%EB%A6%AC-%EA%B4%80%EB%A0%A8-%EC%84%A4%EC%A0%95 >> 메모리 설정팁

javaslave.tistory.com/23>> java 옵션

atin.tistory.com/625

johngrib.github.io/wiki/java8-why-permgen-removed/    >>1.7 vs 1.8

mirinae312.github.io/develop/2018/06/04/jvm_memory.html  >>JVM Heap 메모리구조 간단히 보기

JVM MEMORY
JDK 

 

 

728x90


java 8

try with resource  : doc 보기

1
2
3
        try (Connection connection = DriverManager.getConnection(url, username, password)){
            System.out.println("Connection create:"+connection);
        }


lambda : doc 보기

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
    public static void main(String[] args) {
 
        List<Person> people = Arrays.asList(//
                new Person("Charles""Dickens"60), new Person("Lewis""Carroll"42),
                new Person("Thomas""Carlyle"51), new Person("Charlotte""Brante"45),
                new Person("Mattew""Arnold"39));
  //--> 이부분
        System.out.println("Printing all persons");
        //System.out.println(person)  :
        // p -> method(p)
        //person -> System.out.println(person)
        printConditionaly(people, person -> trueSystem.out::println);
    }
 
    private static void printConditionaly(List<Person> people, Predicate<Person> predicate, Consumer<Person> consumer) {
        for (Person person : people) {
            if (predicate.test(person))
                consumer.accept(person);
        }
    }
cs


728x90

알고리즘 문제풀기 시작.

그냥 그렇다고하는거 시간을 재면서 써보니까 좋네^^




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Backjoon1000_DrEngineer
{
    public static void main(String[] args) throws IOException
    {
        //메모리 13024KB 시간:92ms
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        String inputValue;
        String[] numbers = new String[2];
        while ((inputValue = bufferedReader.readLine()) != null)
        {
            numbers = inputValue.split(" ");
 
            System.out.print(Integer.valueOf(numbers[0]) + Integer.valueOf(numbers[1]));
        }
 
        /*        // 메모리 14408   112
        Scanner scanner = new Scanner(System.in);
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        if (!(0 >= A || B >= 10))
            System.out.print(A + B);
        scanner.close();*/
        /*        // 메모리 14440 시간  112
        Scanner scanner = new Scanner(System.in);
        int A = scanner.nextInt();
        int B = scanner.nextInt();
        if (0 < A && B < 10)
            System.out.print(A + B);
        scanner.close();*/
    }
}



cs




728x90

1. 검색했을 때 에러이유

권한 or 주소 잘못 작성



2. 현재 java 1.7 환경 이클립스에서 git pull 에러 발생 

git-upload-pack  


해결 원인 : git 에서 지원하는 java 버전 1.8 , 내가 쓰는건 1.7

해결:  이클립스 ini 파일 설정에 -vm (자바 경로 수정)


참고 : 

https://community.atlassian.com/t5/Bitbucket-questions/JGit-quot-cannot-open-git-upload-pack-quot-error-message-on/qaq-p/604160



충돌시. 

-git stash

git pull origin master

git stash apply

https://backlog.com/git-tutorial/kr/stepup/stepup6_2.html



eclipse : cannot open git-upload-pack

window > preference > team > git > configuration

add entry의 key, value에 다음과 같이 넣자.

 - key : http.sslVerify

 - value : false



출처: http://webie.tistory.com/94 [webie's blog]


cannot open git-receive-pack

Context Menu에서 "Configure Push" 를 선택한다.


"Configure push for remote 'origin' 에서 "Change..." 버튼을 선택한다.


출처: http://roadrunner.tistory.com/605 [삶의 조각들]

+ Recent posts