What is the difference between: double deletion, memory leak, and deletion of stack memory? What are the conditions that cause each of these errors? I ask this in reference to question 5 on this test. I’m not too familiar with what is good practice vs. bad practice when it comes to this stuff, so any guidelines/tips are appreciated!
What is the difference between: double deletion, memory leak, and deletion of stack memory?
Share
The referenced link has a test with answers already on it, so I don’t think further clarifying the test’s answers will be helping to cheat.
A correct program will always execute exactly one call to delete for each call to new. All of these things are violations of this rule.
A double deletion calls delete more than once.
A memory leak doesn’t call delete at all.
And deletion of stack memory calls delete on memory that was not returned from new.