myFunction

()

Child

child

Child

();

// The `child` object was allocated in memory.

// It's now retained from garbage collection

// by one retaining path (root …-> myFunction -> child).

Parent

parent2

Parent

().

child

child

parent1

child

child

// At this point the `child` object has three retaining paths:

// root …-> myFunction -> child

// root …-> myFunction -> parent2 -> child

// root -> parent1 -> child

child

null

parent1

child

null

parent2

null