Professional Documents
Culture Documents
Memory Management: The Stack & The Heap
Memory Management: The Stack & The Heap
A stack is a LIFO
A queue is a FIFO
Value types and reference types
Value types are placed on the Stack (and sometimes on the Heap)
Reference types are placed on the Heap (and on the stack we have a pointer to
them)
Value types
Enums
DateTime
Bool
Char
Example:
Example
Reference types
String
Object
String is immutable
StringBuilder is mutable