Coding Shorts: Making Sense of Stack vs. Heap

  Рет қаралды 1,887

Shawn Wildermuth

Shawn Wildermuth

Күн бұрын

This is a different kind of video that I usually make. The topic of how memory is handled in a variety of languages is a key concept every developer should have a handle on. In this quick tutorial, I try and explain how it works. Take a look!
If you like this video, you might like other videos in my Instructional Videos:
• Instructional Videos

Пікірлер: 15
@RobertSagoe
@RobertSagoe 3 ай бұрын
Your explanation is clear and concise, making the process easy to understand. Thank you for the details and excellent graphical explanation .. really helpful
@swildermuth
@swildermuth 3 ай бұрын
Glad you enjoyed it!
@gandodiallo4146
@gandodiallo4146 3 ай бұрын
You are the best Shawn
@LUNTE1337
@LUNTE1337 3 ай бұрын
Excellent explanation and visualization!
@swildermuth
@swildermuth 3 ай бұрын
Glad you liked it!
@tak8460
@tak8460 3 ай бұрын
Nice explanation. It helped clarify a few things. Thank you for your efforts!
@swildermuth
@swildermuth 3 ай бұрын
You are welcome!
@adsfaedaer
@adsfaedaer 3 ай бұрын
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 ?
@swildermuth
@swildermuth 3 ай бұрын
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?
@heavypeki
@heavypeki 3 ай бұрын
@@swildermuth Perfectly makes sense. Struct in itself is a value type, but isn't responsible for its own members which could be address pointer.
@kinsondigital
@kinsondigital 3 ай бұрын
Great explanation!! Love it!
@swildermuth
@swildermuth 3 ай бұрын
So glad!
@williamliu8985
@williamliu8985 3 ай бұрын
Is it able to see if the target is in stack or heap when debugging?
@swildermuth
@swildermuth 3 ай бұрын
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).
@williamliu8985
@williamliu8985 3 ай бұрын
@@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.
Coding Shorts: C# Dialects and Idioms
19:13
Shawn Wildermuth
Рет қаралды 3,3 М.
Coding Shorts #102: Using SQL Server Containers for Dev
11:00
Shawn Wildermuth
Рет қаралды 2,9 М.
А ВЫ ЛЮБИТЕ ШКОЛУ?? #shorts
00:20
Паша Осадчий
Рет қаралды 9 МЛН
SHAPALAQ 6 серия / 3 часть #aminkavitaminka #aminak #aminokka #расулшоу
00:59
Аминка Витаминка
Рет қаралды 2,1 МЛН
💩Поу и Поулина ☠️МОЧАТ 😖Хмурых Тварей?!
00:34
Ной Анимация
Рет қаралды 2 МЛН
Coding Shorts 108: Using TestContainers in .NET Core
17:27
Shawn Wildermuth
Рет қаралды 1,4 М.
Coding Shorts: Ahead-of-Time Compilation in C# (AOT)
12:03
Shawn Wildermuth
Рет қаралды 2 М.
Only Compute What You Need for Faster Programs
10:44
Senior Code Review Buddy
Рет қаралды 679
Being Competent With Coding Is More Fun
11:13
TheVimeagen
Рет қаралды 85 М.
Is THIS Python's MOST Underrated Operator? (Walrus Operator)
5:45
WHY IS THE STACK SO FAST?
13:46
Core Dumped
Рет қаралды 156 М.
Coding Shorts #101: Getting More Out of Your ASP.NET Core HealthChecks
10:49
All Rust features explained
21:30
Let's Get Rusty
Рет қаралды 311 М.
Just enough C to have fun
39:29
Kay Lack
Рет қаралды 49 М.
JavaScript Visualized - Execution Contexts
11:41
Lydia Hallie
Рет қаралды 59 М.
А ВЫ ЛЮБИТЕ ШКОЛУ?? #shorts
00:20
Паша Осадчий
Рет қаралды 9 МЛН