previous | index | next

Returning Memory Used by Dynamic Arrays and Structs

When a program is finished using an object dynamically created with new, it should return the memory used back to the system's free store.

Q: Why?

A: A program that runs a long time, repetitively allocating memory without giving it back, could eventually run out of memory.

This is metaphorically referred to as a memory leak.


previous | index | next