Похожие чаты

For example, how much?

3 ответов

14 просмотров

Do memory footprint yourself u will understand

http://java-performance.info/overview-of-memory-saving-techniques-java/

Each object instance holds a pointer to it's class object, this is exactly the extra memory for each wrapper object. I guess, it's system dependent, and it would be 8 bytes on 64 bit machine. It means that each "Integer" object, for example, takes 4b+8b=12b of memory in heap while of primitive "integer" that takes 4b on stack or in heap (this difference is mostly irrelevant in java in terms of performance). For booleans, if they are represented as 1b what is usually the case, it's 1b+8b=9b that is 9 times more memory. However, for booleans usually there's no need to create new instance, just use Boolean.TRUE or Boolean.FALSE. Same happens for some set of other primitive common values (like 0-256): if they can be determined at compile time compiler uses statically defined value. Autoboxing works the same way, if I remember correctly. As you see using objects has significant impact on memory it takes. But in most cases it doesn't really matter much. Just check heap dump of your application and calculate how much would grow memory footprint if you were using wrapper classes. I bet not much. Unless you're developing for embedded device you just shouldn't care too much. Even for most cases in android development. However, you should consider this extra memory footprint if you develop something that is very restrictive in memory or very number manipulation extensive.

Похожие вопросы

Обсуждают сегодня

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта