flâneur — a map of the web's best reading

CS106B Memory Debugging Warmup

web.stanford.edu · saved by 1 readers

Use these debugging warmup exercises to practice with the tools and skills that will arm you to successfully manage the tricky aspects of linked lists. Unsurprisingly, the common pitfalls for linked lists come down to mistakes with memory and pointers. These are difficult concepts in C++, and you can never get too much practice. A memory leak is created when a program allocates memory using new but does not call delete to deallocate the memory when finished with it. A leak is analogous to forgetting to check out of your hotel room, causing the hotel staff to believe your room is still occupied and to not reassign it to a new customer. Unlike a memory error, which can cause a program to crash or behave erratically, a memory leak has fairly benign consequences. The only side effect of a memory leak is that the leaked memory is not available for recycling. If a program had many leaks and each was a large amount of memory, it could eventually exhaust all of the system memory and be unable

Use these debugging warmup exercises to practice with the tools and skills that will arm you to successfully manage the tricky aspects of linked lists. Unsurprisingly, the common pitfalls for linked lists come down to mistakes with memory and pointers. These are difficult concepts in C++, and you can never get too much practice. A memory leak is created when a program allocates memory using new but does not call delete to deallocate the memory when finished with it. A leak is analogous to forgetting to check out of your hotel room, causing the hotel staff to believe your room is still occupied

Explore this link on the map →