Eric G posed a questions about the lifetime of local variables.  It had quite an interesting result.   If the local varaible isn’t used any more in the function then the garbage collector can reclaim the memory of the variable.   However, if you complie the sample in debug mode it produces a different outcome. 

Advertisements