Applications make use of two parts of memory called:
The Stack
The Heap
In short, value types are stored in the Stack and reference types are stored in the Heap.
What does this mean? Well, let's look into it more.
Value types are stored in the Stack. You can think of the variables as being stacked on top of one another.
Access to the Stack is very fast.
The last value type allocated will be the first one to be deallocated. (Last In, First Out, or "LIFO" stack.)
Allocation happens when your app is compiled.
Reference types are stored in the Heap.
Reference types in the heap are only released when they have no reference count.
Accessing this memory is a little bit slower compared to the stack. (This is relative, mind you. It's still super fast on today's processors.)
Objects in here can be accessed randomly.
Objects in here can be removed randomly.
Grows and shrinks as objects are added and removed.
Allocation happens when your app is run.
So what if a class (reference type) has some bools and ints (value types) declared within it? This is a common scenario. Value types can be wrapped up in reference types and will live in the Heap.
Closures are reference types. That means they live in the Heap. The value type will be moved to the Heap so the closure can have access to it for the life of the closure.