![](http://i1.daumcdn.net/thumb/C148x148/?fname=https://blog.kakaocdn.net/dn/EdN9h/btqLA4ioX1J/9noSUkGMDg0u5qKOTr22Dk/img.png)
참조(Reference)와 GC(Garbage Collection)의 관계 1. Strong Reference public class JavaTest { public static void main(String[] args) { MyClass obj = new MyClass(); obj = null; // "obj" object is no longer referencing to the instance. // So the "MyClass" type object is now available for garbage collection. } } class MyClass { } // Java program to illustrate Strong reference class MyClass { //Code.. } pub..
1. StrongReference - 일반적으로 new를 통해서 객체를 생성하게 되면 생기게 되는 참조 - 강한 참조를 통해 참조되고 있는 객체는 GC(Garbage Collection)의 대상에서 제외 - GC(Garbage Collection)가 발생해도 객체가 해제되지 않기 때문에 OOM(Out of memory)이 발생할 수 있음 2. SoftReference - 강한 참조와는 다르게 GC(Garbage Collection)에 의해 수거될 수도 있고, 수거되지 않을 수도 있음 - 메모리에 충분한 여유가 있으면 GC(Garbage Collection)가 수행돼도 수거되지 않음 - GC(Garbage Collection)가 발생하면 수거되므로 OOM(Out of memory)의 위험성을 줄일 수 있음..
GC(Garbage Collection) - 메모리 관리 기법 - 프로그램이 동적으로 할당했던 메모리 영역 중에서 필요 없게 된 영역을 해제하는 기능 - GC(Garbage Collection)를 실행하는 스레드를 제외한 모든 스레드들이 작업을 멈춤 STW(Stop The World) - GC 실행을 위해 JVM이 애플리케이션 실행을 멈추는 것 - GC(Garbage Collection) 작업을 완료한 이후에 중단했던 작업이 재개됨 Mark and Sweep 1) Mark - GC(Garbage Collection)가 스택의 모든 변수 또는 Reachable 객체를 스캔하면서 각각 어떤 객체를 참조하고 있는지 찾는 과정. 이 과정에서 STW(Stop The World) 발생. 2) Sweep - Mark..
![](http://i1.daumcdn.net/thumb/C148x148/?fname=https://blog.kakaocdn.net/dn/baQRoY/btqLweS5s6w/qazwRBBa69YpUFfFVKe3K1/img.png)
리스트(List)는 무엇인가? import java.util.* fun main() { // 연결리스트(LinkedList) 데이터 삽입 시간 val linkedList: LinkedList = LinkedList() linkedList.add("1") linkedList.addAll(arrayOf("2", "3")) linkedList.addFirst("Head") linkedList.addLast("Last") println(linkedList) var startTime = System.currentTimeMillis() for (i in 0 until 10) { linkedList.add(4, "?") } println(linkedList) println("연결리스트(LinkedList) 데이터 삽..
- Total
- Today
- Yesterday
- DataBinding
- Intent
- TabLayout
- Livedata
- James Kim
- handler
- Android
- 안드로이드 #코틀린 #Android #Kotlin
- Vue.js #Vue.js + javascript
- XML
- ArrayList
- coroutine
- View
- Architecture Pattern
- fragment
- MVVM
- 혀가 길지 않은 개발자
- JSONArray
- 코틀린
- Kotlin
- activity
- Design Pattern
- CoordinatorLayout
- JSONObject
- 안드로이드
- ViewPager2
- ViewModel
- recyclerview
- java
- 자바
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |