The exercise asks which programs run out of memory and crash based off a given amount of stack and heap memory. Technically, this program won't crash, but it will still have a memory leak. It appears that was not the intention of the exercise:
The rest of the programs with dynamic memory have deletes
Some of their deletes still result in a memory leak, but one that makes the program run out of memory and crash
This is the program with the issue:
int main() {
int *arr = new int[10000];
for (int i = 0; i < 10000; ++i) {
arr[i] = i;
}
}
The exercise asks which programs run out of memory and crash based off a given amount of stack and heap memory. Technically, this program won't crash, but it will still have a memory leak. It appears that was not the intention of the exercise:
This is the program with the issue: