Suppose I have the following function:
int func(void) { std::vector<int> vec1; vec1.push_back(10); std::vector<int> vec2(vec1.begin(), vec1.end() ); return 0; } As I understand it, after calling vec1 and vec2, they are released from the stack as local variables. Is the heap freed from the arrays pointed to by vec1 and vec2?