Yes, it is garbage collected if no other references are pointing to that block of memory because it is an anonymous function (lambda). So the memory block would be stale and eventually garbage collected; but if other things reference that memory block outside of the module then setting it to nil will not garbage collect that anonymous function.