in reply to Re^2: 'my' Variable life cycle
in thread 'my' Variable life cycle

No, if you want a variable's memory to be released when the function exits, you need to not return a reference to that variable.