http://qs321.pair.com?node_id=675734


in reply to Re^5: references--hard vs anonymous operational weirdness
in thread references--hard vs anonymous operational weirdness

As you can see the same address is being reused.

Even if it wasn't optimized, that wouldcould be the case too.

In the non-optimized world, the my variable would get freed at the end of the for loop (since there are no longer any references to it) and reallocated at the top. Logically, the memory manager wouldcould find the same free block the second time around as the first since nothing changed.

While there is an optimization involved here to save some memory management work, it doesn't cause any change in the observed behaviour. What you call an optimization is just garbage collection, not an optimization at all.

Updates marked using INS and DEL elements. See chromatic's reply for details.