Home Segments Index Top Previous Next

645: Mainline

You might wonder why C++ does not reclaim memory automatically whenever a pointer is reassigned to a new object created by the new operator. The rationale is that chunks of memory accessed through a pointer are often accessible through more than one pointer. Accordingly, C++ cannot assume that reassignment of a single pointer makes a chunk of memory inaccessible.