Your explanation is clear and concise, making the process easy to understand. Thank you for the details and excellent graphical explanation .. really helpful
when the stack pops what happens to a struct - which is a value type - that contains a string. is the string immediately culled (because the struct has been cleaned up) or does it wait around for the GC? - also how many pancakes where consumed after you did this ?
any reference types that the struct is holding on to will be released to the GC but not disappear immediately. The Struct is a value type but it doesn't promote members of the struct to value types, remember the reference types in the struct are just the addresses of the reference types in the heap. Does that make sense?
I don't see a way, but of course, you can see the type (and infer it's on the stack) - might want to look at C# boxing too (essentially making a reference to a value type so that it becomes a reference type).
@@swildermuth Thanks! It would be nice if their locations were clearly indicated in the debugger so that programmers don't have to guess about such a basic but important concept.
Your explanation is clear and concise, making the process easy to understand. Thank you for the details and excellent graphical explanation .. really helpful
Glad you enjoyed it!
You are the best Shawn
Nice explanation. It helped clarify a few things. Thank you for your efforts!
You are welcome!
Excellent explanation and visualization!
Glad you liked it!
Great explanation!! Love it!
So glad!
when the stack pops what happens to a struct - which is a value type - that contains a string. is the string immediately culled (because the struct has been cleaned up) or does it wait around for the GC? - also how many pancakes where consumed after you did this ?
any reference types that the struct is holding on to will be released to the GC but not disappear immediately. The Struct is a value type but it doesn't promote members of the struct to value types, remember the reference types in the struct are just the addresses of the reference types in the heap. Does that make sense?
@@swildermuth Perfectly makes sense. Struct in itself is a value type, but isn't responsible for its own members which could be address pointer.
Is it able to see if the target is in stack or heap when debugging?
I don't see a way, but of course, you can see the type (and infer it's on the stack) - might want to look at C# boxing too (essentially making a reference to a value type so that it becomes a reference type).
@@swildermuth Thanks! It would be nice if their locations were clearly indicated in the debugger so that programmers don't have to guess about such a basic but important concept.