November 2017
Intermediate to advanced
398 pages
10h 14m
English
Sometimes, a never-ending cycle can be created due to two objects that only refer to each other. Their count will never reach zero for both of them, resulting in an active status throughout the program and inefficient memory allocation.
Cycles are removed through specific algorithms that are able to detect such instances. One strategy is to use back pointers and create weak references when a cycle position is achievable in two objects. A weak reference does not increment the count; therefore, it can reach a null reference count value.