ram

References

Summary

RAM is made up of 2 parts:

  1. The stack
  2. The heap

How Memory Works

Your CPU reads memory in chunks called cache lines, usually 64 bytes at a time and throws them in the L1 cache

Stack

Contiguous

Very fast

Stores small, fixed-size data

The stack frame is wiped as soon as a function finishes executing

Heap

Giant global pool of memory For long-lived data, data that changes size, and structures that need to be shared across multiple parst of a program

Everything on the heap has associated data that must be stored with it: