CSC300: Python to Java: What is memory? [38/40] Previous pageContentsNext page

What does the machine memory look like when you see a picture like this:

memory-layout-numFives

To fully answer this question, you need to take the systems classes. But it is useful to have an idea of the memory, even if the details are not exactly correct.

Method calls (Stack) Objects (Heap)
Address Value Description
0xbeef0098??@1.overhead
0xbeef00900xface0000@1.args
0xbeef00880xface0010@1.list

0xbeef0080??@2.overhead
0xbeef00780xface0010@2.a
0xbeef00703@2.i
0xbeef00682@2.result
Address Value Description
0xface00385.0Array.data[3]
0xface00305.0Array.data[2]
0xface002811.0Array.data[1]
0xface00205.0Array.data[0]
0xface00184Array.length
0xface0010??Array.overhead

0xface00080Array.length
0xface0000??Array.overhead

Above, I show two parts of memory. On the left is storage for method calls (commonly called the stack), on the right is storage for objects (commonly called the heap). Arrays are objects in java. Machine addresses are shown as hexadecimal [Search] numbers beginning with the prefix 0x.

Each entry includes some overhead.

Previous pageContentsNext page