Memory
Basics
Bit - 0
or 1
Byte - 8
bits
Mega Byte - 1 million or bytes
Giga Byte - 1 Billion or bytes
Old Machines, we used to assume 32 bits with 4 byte pointers
Modern Machines, we used to assume 64 bits with 8 byte pointers
Can address more memory
Pointers uses more memory
Typical memory usage of primitive types and arrays
Type | Bytes |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
For one Dimensional arrays ( N )
Note: Over head of
24 bytes
Type | Bytes |
---|---|
|
|
|
|
|
|
For two Dimensional arrays ( M * N )
Type | Bytes |
---|---|
|
|
|
|
|
|
Java Objects
Object overhead - 16 bytes
Object Reference - 8 bytes
Padding - Each object uses a multiple of 8 bytes
Last updated