Home Segments Index Top Previous Next

572: Mainline

You might wonder why C does not reclaim memory automatically whenever a pointer is reassigned to a new object created by the malloc function. 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.