Stack allocation:
1void function() {2 int x = 10; // stack3 int arr[100]; // stack4} // automatically freed
Heap allocation:
1void function() {2 int* p = new int(10); // heap3 auto v = std::make_unique<int[]>(1000); // heap4} // p leaked, v auto-freed
Best practices: