일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 딕셔너리
- dictionary
- Asteroid RL
- 딥러닝
- 미분 방정식
- BST
- 피보나치 수열
- 강화학습
- 벡터해석
- Class
- 자바
- 소행성
- 회로이론
- 이진탐색트리
- 선적분
- java
- 신경망
- 파이썬
- 백트래킹
- auto-encoder
- 벡터 해석
- 델
- 최단 경로
- 계단 오르기
- 2P1L
- cURL
- 자료형
- 함수
- Python
- 코드업
- Today
- Total
Zeta Oph's Study
[Data Structure (Java)] Memory Usage Analysis 본문
https://crane206265.tistory.com/93
[Data Structure (Java)] Tree (6) - 2-3 Tree & LLRB Tree
https://crane206265.tistory.com/92 [Data Structure (Java)] Tree (5) - AVL Treehttps://crane206265.tistory.com/90 [Data Structrue (Java)] Tree (4) - Binary Search Tree Maphttps://crane206265.tistory.com/89 [Data Structure (Java)] Sethttps://crane206265
crane206265.tistory.com
깜빡하고 메모리 사용을 안한거 같아서. 시험 전 마지막 글이지 않을까요..? (사실 소재는 남았는데, 시간이 없는..)
Background Knowledge
bit : 0 or 1
1 bite = 8 bits
* --> 64-bit computer : computer with 8 byte pointers
Memory Usage of Primitive Types
Type | Memory Usage | Type | Usage |
int | 4 bytes | boolean | 1 byte |
float | 8 bytes | byte | 1 byte |
long | 8 bytes | char | 2 bytes |
double | 8 bytes |
Memory Usage of Personally Designed Object
reference : 8 bytes
object overhead : 16 bytes
- ref. to the object's class, garbage collection, information synchronization
--> 8 bytes (reference) + 8 bytes (for others) = 16 bytes
* padding : each object uses a multiple of 8 bytes (also padding for overhead)
--> object's memory usage = object overhead + variables in object + padding
* wrapper type memory != primitive type memory
Ex 1) int array of length N
array overhead : 24 bytes
[ object overhead 16 bytes + array length (int value) 4 bytes + padding 4 bytes ]
+
element : 4N bytes
= 24 + 4N bytes (if N is odd : add padding 4 bytes)
Ex 2) array of N objects
array overhead : 24 bytes
+
references to objects : 8N bytes
+
each objects (K bytes) * N
= 24 + (8+K)N bytes (if needed, add padding)
* double a[];
: just using memory for reference (8 bytes), not already generated array
'프로그래밍 > Java' 카테고리의 다른 글
[Data Structure (Java)] Tree (6) - 2-3 Tree & LLRB Tree (1) | 2024.06.11 |
---|---|
[Data Structure (Java)] Tree (5) - AVL Tree (2) | 2024.06.09 |
[Data Structrue (Java)] Tree (4) - Binary Search Tree Map (1) | 2024.06.06 |
[Data Structure (Java)] Set (1) | 2024.06.05 |
[Data Structure (Java)] Hash (Separate Chaining & Linear Probing) (1) | 2024.06.05 |