Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java: How much memory a reference implies?

As the question says, how much memory is used for a reference to an Object in the Java Programming Language?

Please, if you have a trusted source is better.

Thanks a lot!

like image 981
santiagobasulto Avatar asked Oct 18 '25 03:10

santiagobasulto


1 Answers

It's not specified by the language or JVM spec. However, it's generally accepted that any sane implementation will be 4 bytes on a 32-bit machines and between 4 and 8 bytes (depending on compressed pointer settings, etc.) on a 64-bit machine.

like image 89
dty Avatar answered Oct 20 '25 17:10

dty