[Android] Enum Type을 피하라?
Android/Tips 2015. 11. 25. 11:46 |Be aware of memory overhead
Be knowledgeable about the cost and overhead of the language and libraries you are using, and keep this information in mind when you design your app, from start to finish. Often, things on the surface that look innocuous may in fact have a large amount of overhead. Examples include:
- Enums often require more than twice as much memory as static constants. You should strictly avoid using enums on Android.
- Every class in Java (including anonymous inner classes) uses about 500 bytes of code.
- Every class instance has 12-16 bytes of RAM overhead.
- Putting a single entry into a
HashMap
requires the allocation of an additional entry object that takes 32 bytes (see the previous section about optimized data containers).
A few bytes here and there quickly add up—app designs that are class- or object-heavy will suffer from this overhead. That can leave you in the difficult position of looking at a heap analysis and realizing your problem is a lot of small objects using up your RAM.
https://developer.android.com/intl/ko/training/articles/memory.html#Overhead
'Android > Tips' 카테고리의 다른 글
디자인 패턴의 종류 (0) | 2018.03.13 |
---|---|
[dex2jar]추출한 APK 파일에서 classes.dex 파일 디컴파일(decompile)하기 (0) | 2016.07.26 |
Android Emulator hosts 변경 방법 (0) | 2015.11.17 |
Android Proguard 설정법 (0) | 2015.06.02 |
Google I/O 2015에서 언급된 새로운 OS (Android M)에 대한 내용 요약 (0) | 2015.06.01 |