Stack vs Heap Memory - Simple Explanation

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ก.พ. 2025

ความคิดเห็น •

  • @michaeltheisen
    @michaeltheisen ปีที่แล้ว +251

    These ideas were saved in my head as a sequence of words for the entirety of my undergrad. If 5 short minutes you managed to actually help me understand a huge gap in my understanding. Thank you so much.

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว +7

      You're welcome Michael, I am glad it helped.

    • @saumyojitdas4212
      @saumyojitdas4212 ปีที่แล้ว

      ​@@alexhyettdev
      public class Main
      {
      String s = "ABC";
      public static void main(String[] args) {
      Main obj = new Main() ;
      System.out.println(obj.s);
      }
      }
      in this above code String object is created in heap and also of class.
      So 2 objects in heap.
      But isn't the string object Abc resides inside class object in the heap?that's why we are calling it obj.s

    • @rembautimes8808
      @rembautimes8808 ปีที่แล้ว

      Good video very in-depth

    • @crazychase443
      @crazychase443 11 หลายเดือนก่อน

      i feel the exact same way!! this random collection of words and statements now i feel like concrete concepts in my brain

    • @aborda0987
      @aborda0987 6 หลายเดือนก่อน

      @@alexhyettdev Quick question. You mentioned that when a pointer/ref in the stack is deleted, the value it points to dangles around the heap until the GC collects it, but what happens in a language like C++ there is not GC? Would that become a memory leak?

  • @Tanessok
    @Tanessok 10 หลายเดือนก่อน +2

    Thank you sir. Good Explanation.
    Please, I wish you make a video on "Why in Java, Do Local Variables Used in Lambdas Have to Be Final or Effectively Final?" and please make the explanations at the memory level too, so we can understand all the mechanics behind it.

  • @kohltonpeterson3287
    @kohltonpeterson3287 ปีที่แล้ว +19

    This is one of the best programming related videos I have ever watched. It cleared up so much of my confusion in C++.

  • @luminuslux
    @luminuslux ปีที่แล้ว +54

    Not gonna lie, i cant state enough how explanations like this can massively improve your understanding of why code works the way it does. Just learning to code is one thing, but understanding whats behind all of it and WHY whatever thing actually is happening, can definitly up your game. Im not a pro by any means, but i think stuff like this is very important.
    The visual presentation also makes it way easier to follow and connect the concepts - so thx for that 😊

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว +3

      Thank you, I am glad you enjoyed the video. I find it helps with remembering everything as well. If you can understand something then it tends to stick in your mind a bit better.

    • @Pratik0917
      @Pratik0917 2 หลายเดือนก่อน

      Fab explanation.. Saw many videos however nobody has explained clearer than you..Thank you

  • @TylerCalifornia
    @TylerCalifornia ปีที่แล้ว +38

    Alex, you made my day. I would call you one of the best instructors! Your explanations are flawless. You explain perfectly in context. For instance, where you explain why variables are not accessible outside the method.

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว +1

      Jake, you made my day! Thank you for the lovely comment. I am glad you found it helpful!

  • @bitwise-dev
    @bitwise-dev ปีที่แล้ว +4

    Finally a much simpler with actual sample code that explain the whole stack and heap stuff. Now I understand why and when OOM occurs in app, the usual suggestion is to increase heap size but said to be slow or when we do recursion recklessly we get stackoverflow.

  • @scubagoblin
    @scubagoblin ปีที่แล้ว +6

    Reading a book right now that explains this concept rather poorly over 20 pages. You managed to grant me understanding in 5 minutes, and now I can continue reading past the chapter. Thank you, great explanation!

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว +1

      You’re welcome! I am glad I could help you understand it. Hopefully more fun than reading 20 pages of that book.

  • @fuadadio
    @fuadadio 8 หลายเดือนก่อน +2

    Your videos are awesome and very clear.
    Can't wait for a full CS playlist. Thanks for what you do for the community Alex.

  • @RYANCARNEY-dc2qe
    @RYANCARNEY-dc2qe 9 หลายเดือนก่อน +3

    This video actually answered all my questions about how the stack and heap work together. Great explanation!

  • @sonederbr
    @sonederbr 2 ปีที่แล้ว +26

    The best explanation/animation ever.

  • @christymathew9035
    @christymathew9035 8 หลายเดือนก่อน +15

    YOU ARE LITERALLY CAPABLE OF REPLACING 99 PERCENT OF TEACHERS WHO PATHETICALLY FAILED TO TEACH ME THIS CONCEPT. THE CLARITY WITH WHICH YOU JUST EXPLAINED IT SHOWS THE TRUE MASTERCLASS YOU ARE IN. I WISH I DINT WASTE MONEY IN COLLEGE WHEN PEOPLE LIKE YOU EXIST. LOVE YOU SIR ❤

  • @patrickmccarthy7124
    @patrickmccarthy7124 ปีที่แล้ว +4

    The analogy of a stack of books provided much needed clarity for me. I appreciate the video mate!

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว

      You’re welcome, I am glad it was helpful.

  • @b25671
    @b25671 6 หลายเดือนก่อน

    I've seen multiple videos of you now... you can explain the essence of things very well. It's a talent. Very good. Thank you!

  • @thepianist7379
    @thepianist7379 หลายเดือนก่อน

    This is the best explanation of stack vs heap because it relates to actual coding. Fantastic job!

  • @Saad.Makhdumi
    @Saad.Makhdumi 3 หลายเดือนก่อน

    Very good explanation, in short amount of time. I hope all IT folks see this video and understand these topics. Thank you Alex.

  • @0bsy96
    @0bsy96 ปีที่แล้ว +3

    My jaw dropped when you explained what happens to variables declared in the stack, I never made the connection between this fact and the scope of variables, thank you soooo much !!!

    • @nikolabosevski1435
      @nikolabosevski1435 ปีที่แล้ว

      Samee heree, I've never even thought of why we couldn't call variables from different scopes, i just took it for granted this opened my eyes

    • @TheHermitProcess
      @TheHermitProcess 11 หลายเดือนก่อน

      I'd be extremely weary of taking this for fact. It is up to the compiler to generate scoping rules, as far as I know. Look into it a bit more.

  • @alexsal6069
    @alexsal6069 ปีที่แล้ว +2

    This is an excellent video about how the memory works, I love the last part about asynchronous methods. Thank you for this awesome content. I wish you could speak more about asynchronous functions. 😃

  • @i_am_dumb1070
    @i_am_dumb1070 ปีที่แล้ว +1

    Thank you very much i was not able to understand this concept even after reading and watching a lot of videos now i have a good understanding of this

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว

      That’s great! I am glad I helped.

    • @i_am_dumb1070
      @i_am_dumb1070 ปีที่แล้ว

      @@alexhyettdev if possible can you please explain the anonymous function part i didn't get it

  • @brunofilgueiras3518
    @brunofilgueiras3518 8 หลายเดือนก่อน +1

    such a clear explanation couldn't get better thanks Alex

  • @AhmedAlsabsab
    @AhmedAlsabsab 8 หลายเดือนก่อน

    Finally I understand the difference in few words and short time... keep doing videos like this

  • @benessilfie
    @benessilfie ปีที่แล้ว +5

    This explanation was exactly what I needed! thank you Alex

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว +1

      You’re welcome I am glad it helped!

  • @austinhummel5439
    @austinhummel5439 7 หลายเดือนก่อน

    I can't put into words how helpful this video was. Thank you Alex!

  • @tylerlwsmith
    @tylerlwsmith ปีที่แล้ว +6

    Incredible. Even though I've been a professional developer for six years, I was having a crisis of confidence tonight because I've worked with languages where I never have to worry about this directly. I was asking myself, "Do I even know anything about computers if I don't know the difference between the stack and the heap?"
    Five minutes and twenty-seven seconds later, I feel like I have a solid understanding of the difference and I'd be capable of talking about this intelligently. Thank you 🙏

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว +1

      I have been a developer for 12 years and I went through exactly the same thought process before making this video. I am really glad it helped you.

    • @___gg421
      @___gg421 ปีที่แล้ว +1

      Same here just went through a training where some memory management stuff was covered and I felt like an imposter. This made it all make sense

  • @Misteribel
    @Misteribel ปีที่แล้ว +2

    3:01 small correction. A const is NOT allocated on the heap. In fact, it's embedded on the call site at compile time (in C#/F#/VB), the reference is removed (you can test this: create a const in another lib, reference and use it in your lib. Compile. Now update the const in the referenced lib and recompile, but do not recompile your lib. You'll see it did not change on the call site). What you probably want is readonly, which, in your example at 3:01, would then be allocated on the heap.

  • @csanid1
    @csanid1 ปีที่แล้ว +1

    hey this is an excellent video! i'd never thought or read about the link between variable scope and memory. thank you so much!

  • @agun214
    @agun214 9 หลายเดือนก่อน

    hell yeah. idk how you did it but that finally made sense. i had to have heard the stack of books analogy before, but this is probably the first time seeing it played out with actual books
    imma have to watch this again

  • @mojizze
    @mojizze 11 หลายเดือนก่อน

    Finally, i now understand the differences between these two. Thank you for the video

    • @alexhyettdev
      @alexhyettdev  10 หลายเดือนก่อน

      You're welcome 😊

  • @potatopotato4676
    @potatopotato4676 ปีที่แล้ว

    Your explanations are immaculate! You'll definitely make it big if you want to. I am glad I caught your channel early at 18.4k subscribers

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว

      I appreciate that! Will be making more videos soon.

  • @SSn0wx
    @SSn0wx ปีที่แล้ว

    Great explanation. I do mostly web development, but I've been getting into low-level programming recently, and your video really helped me reach out into my bucket of programming concepts and rearrange a bunch of previous knowledge I had about computers into something more clear and concise. Thanks!

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว

      You're welcome, glad I could help!

  • @awys5
    @awys5 7 หลายเดือนก่อน +1

    I've been coding, and teaching code for the past 4 years. This video blew me away. Explained everything so well, and was incredibly easy to follow. Sorry, Alex, I will be stealing this! Amazing work, and you've got a new fan! Thank you!

  • @basedd64
    @basedd64 2 ปีที่แล้ว +4

    Perfect, really good explanation. Thank you!

  • @GG-sw9vm
    @GG-sw9vm ปีที่แล้ว

    that was a clean description of stack and heap. Never knew about anonymous function being a heap, but it makes sense

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว

      Thanks I am glad you liked it 👍

  • @chocolate_Almonds
    @chocolate_Almonds ปีที่แล้ว

    Dude, that was awesome. You explained what I tried to wrap my head around in college courses, in 5 minutes. ily :)

  • @orrymr
    @orrymr 2 หลายเดือนก่อน

    Wow, absolutely brilliant video. Thank you, sir!

  • @johndzikunu9986
    @johndzikunu9986 ปีที่แล้ว +1

    This is good. Have learned some things I could not know in a year.

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว

      That’s great I am glad you learned something from it. Thank you for commenting.

  • @balajia.t1487
    @balajia.t1487 ปีที่แล้ว

    A nice and concise explanation . Wishing you all the best for better reach of your subsequent tutorials so a lot from community would benefit

  • @nomymathieu-petrin5672
    @nomymathieu-petrin5672 ปีที่แล้ว +1

    A hidden gem !!! Thanks you so much, I understand it so much better now !!!!

  • @umarmuzammil7332
    @umarmuzammil7332 หลายเดือนก่อน

    bro love you.... you have demystified things

  • @amalekilawlor2922
    @amalekilawlor2922 ปีที่แล้ว +2

    Wow this was an incredible series of topics, thank you!

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว

      Thanks, I’m glad you enjoyed it!

  • @Soupie62
    @Soupie62 ปีที่แล้ว

    How does garbage collection handle memory fragmentation? Is there a heap defrag utility?
    Do you wipe the heap when a program ends? What is multiple programs / threads run concurrently?
    Now I need to check the rest of your videos for answers.
    Thank you for starting my journey.

  • @dvshkbm
    @dvshkbm วันที่ผ่านมา

    This is fantastic, thank you!

  • @aelesbao
    @aelesbao ปีที่แล้ว +1

    This video needs to be promoted higher on TH-cam. Anyone who wants to learn Rust should start from here before diving into the borrow checker.

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว +1

      Thank you. I am glad it is useful for people learning Rust as well. Some of the C# references might not be applicable but hopefully the rest is. I need to learn rust as well actually!

  • @DigsWigs2022
    @DigsWigs2022 หลายเดือนก่อน

    Great explanation. Thank you Sir.

  • @mehtubbhai9709
    @mehtubbhai9709 ปีที่แล้ว

    @Alex Hyett As always, you give the best explanation of whatever programming topics that you cover.
    Please keep up the great work and keep the content coming. I'm a fan :)

    • @alexhyettdev
      @alexhyettdev  10 หลายเดือนก่อน

      Thank you, I am glad you like them!

  • @EugeneDaveAstator
    @EugeneDaveAstator ปีที่แล้ว

    Awesome video! Id like to add that in csharp async doesnt always equal multithreading, and since it uses internal statemachine which is a class, asyncs may get allocated on the heap

  • @Zmey5656
    @Zmey5656 4 หลายเดือนก่อน

    Thank you, very simple and useful explanation

  • @khaledmoazedi4317
    @khaledmoazedi4317 3 หลายเดือนก่อน

    hey Alex ! it was very great to find your videos on this topic ! so clear and easy . can i grant your permission to translate your videos in persian by my voice and re share them on a channel for persian people to use them?

  • @wajdwael8775
    @wajdwael8775 10 หลายเดือนก่อน

    That is a great, clear, and easy explanation, thank you.

  • @rmcgraw7943
    @rmcgraw7943 6 หลายเดือนก่อน

    In C#, async methods that complete sync, before you await them, will not go onto the heap, hence the reason we have ValueTask now. However, if you use a ValueTask struct and it doesn’t complete sync, then you incur a hit of boxing, allocation, and deallocation (GC collect), which makes it a tiny bit more expensive than the regular Task class.
    One more thing. If you cast any value type to an Interface type, it will go onto the heap, even if it’s a struct or value type.

  • @Ali_Pxll
    @Ali_Pxll ปีที่แล้ว

    Man you're a savior
    thanks for the clear explanation

  • @dantheman52420
    @dantheman52420 2 หลายเดือนก่อน

    Super solid explanation.

  • @MarcoLenzo
    @MarcoLenzo ปีที่แล้ว

    This video was very good! I really like the way you explain!

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว

      Thank you! I am glad you liked it.

  • @timi_t_codes
    @timi_t_codes ปีที่แล้ว

    Thanks for this simple and straight to the point explanation

  • @Mythical_Beastinator
    @Mythical_Beastinator 2 ปีที่แล้ว +1

    Very well explained. Thank you!

    • @alexhyettdev
      @alexhyettdev  2 ปีที่แล้ว

      Thank you, I am glad you liked it!

  • @alejandropoirier6493
    @alejandropoirier6493 ปีที่แล้ว

    Amazing explanation, greetings from Chile

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว

      Thank you! Hi 👋 from UK 🇬🇧

  • @mithunkinarullathil643
    @mithunkinarullathil643 5 หลายเดือนก่อน

    Very good explanation, thank you.

  • @AdrianTregoning
    @AdrianTregoning ปีที่แล้ว

    Create more content, you'll be to a million subscribers within a few short years I have no doubt. Your content is pure gold, thank you for explaining this so clearly.

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว +1

      Thank you 🤞🏻. Regular content will be back again in September. I have had some family commitments that has put a stopper to my videos this month.

    • @AdrianTregoning
      @AdrianTregoning ปีที่แล้ว

      @@alexhyettdev fully understand. Good luck! I quit my full time job as a mechanical engineer to become a programmer/coder of sorts. Bit tough being a student at age 41 but for me I made the decision to ultimately spend more time with my family. Have a super day further.

  • @TonttuTorvinen
    @TonttuTorvinen 6 หลายเดือนก่อน

    Awesome video, very short and to point.

  • @poolable
    @poolable หลายเดือนก่อน

    this video is amazing. subbed

  • @may8128
    @may8128 2 ปีที่แล้ว +1

    Loved the explanation !

    • @alexhyettdev
      @alexhyettdev  2 ปีที่แล้ว

      Thank you! I am glad it was helpful.

  • @Ahmed1Hussein
    @Ahmed1Hussein ปีที่แล้ว

    you actually help me understand a lot ,thank you sir

  • @gavinmeeker287
    @gavinmeeker287 2 ปีที่แล้ว +1

    Really great video! This helped so much

    • @alexhyettdev
      @alexhyettdev  2 ปีที่แล้ว

      Thank you I appreciate the kind words. I am glad it was helpful.

  • @Freepackman
    @Freepackman ปีที่แล้ว

    absolutely brilliant explanation, thanks a lot

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว

      Thanks, I am glad it was useful!

  • @kasunsaumya3151
    @kasunsaumya3151 ปีที่แล้ว

    Simply love your explanations.. Clean and deep..

  • @milehighgaragespeedshop1065
    @milehighgaragespeedshop1065 2 ปีที่แล้ว +1

    Excellent explainer and graphics THX

    • @alexhyettdev
      @alexhyettdev  2 ปีที่แล้ว

      You’re welcome, I am glad you like it.

  • @tejassravanthikasulanati4733
    @tejassravanthikasulanati4733 8 หลายเดือนก่อน

    thats lot of info, more than what i was looking for. 👍

  • @jarenthielen6185
    @jarenthielen6185 11 วันที่ผ่านมา

    Great video. Thanks

  • @dorianneto2859
    @dorianneto2859 ปีที่แล้ว

    Such an intuitive and simple explanation!

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว

      Thank you, I am glad it was helpful.

  • @vfryhn2
    @vfryhn2 2 ปีที่แล้ว +1

    Such a great explanation

    • @alexhyettdev
      @alexhyettdev  2 ปีที่แล้ว

      Thank you! I am glad you liked it.

  • @paulventura3118
    @paulventura3118 ปีที่แล้ว

    Great explanation! Thanks Alex!

  • @vikingghost117
    @vikingghost117 ปีที่แล้ว

    I haven't coded in over a year. I had a dream where I was traversing a world on some quest to explain stack vs heap to all these people getting it wrong, and I knew they were wrong but didn't know why.
    Soon as I woke up I came here. Now I can sleep at night again. Thanks! 😂
    It was an..(Explain you're a nerd without saying you're a nerd XD)... moment.

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว

      I am glad I can help you sleep at night! 😂

  • @jacobL1172
    @jacobL1172 ปีที่แล้ว

    Learning Redux right now, so very helpful! Definitely subscribing.

  • @polimorphic13
    @polimorphic13 10 หลายเดือนก่อน

    Excellent explanation. Thank you so much.

  • @obama213
    @obama213 6 หลายเดือนก่อน

    While asynchronous methods can run on different threads, they do not necessarily have to. Aync execution can also involve single-threaded environments. E.g.: with event loops (JavaScript / Python's asyncio)

  • @JHatLpool
    @JHatLpool ปีที่แล้ว

    Very nice explanation. Thanks !

  • @triphazard2906
    @triphazard2906 ปีที่แล้ว

    lovely explanation, thank you for this

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว

      You’re welcome! I am glad it was useful.

  • @gantushigsaruul2489
    @gantushigsaruul2489 ปีที่แล้ว

    Thank you for easy to understand and great video

  • @SnipSnapSnout
    @SnipSnapSnout 19 ชั่วโมงที่ผ่านมา

    In c (and some other languages), I believe global variables are stored in the data segment, not the heap. It might be worth noting this.

  • @PabloDeLafuria
    @PabloDeLafuria 8 หลายเดือนก่อน

    Great video, great explanation! Thanks

  • @rensukiyo
    @rensukiyo ปีที่แล้ว +1

    Love how clear and concise this was! Subscribing. Just a note, it might be helpful to mention how in C there is no garbage collector and you have to free the memory yourself.

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว

      Thank you! Yes good point C and C++ (and of course Assembly) don't have a garbage collector. As far as I am aware all the others do but there might be a few exceptions!

  • @davidjiang7929
    @davidjiang7929 11 หลายเดือนก่อน

    Thanks for the great explanations!

  • @4rjunc
    @4rjunc 6 หลายเดือนก่อน

    straight to the point 💯

  • @rembautimes8808
    @rembautimes8808 ปีที่แล้ว

    Loved the garbage collector animation. Very nice and funny

  • @miladfahimi4787
    @miladfahimi4787 11 หลายเดือนก่อน

    that was flawless thanks a million man

    • @alexhyettdev
      @alexhyettdev  10 หลายเดือนก่อน

      You're welcome, I am glad you liked it.

  • @Black_Cats_
    @Black_Cats_ ปีที่แล้ว +1

    Good video.
    One question: In the case of results from asynchronous methods, once the asynchronous function completes, who cleans up the result in the heap that was left over by the async function?

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว

      Generally they will be cleaned up by the garbage collector in the same way other objects on the heap are.

    • @Black_Cats_
      @Black_Cats_ ปีที่แล้ว

      @@alexhyettdev thanks for your response

  • @tibebetech4867
    @tibebetech4867 ปีที่แล้ว +1

    Thank you!

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว

      You're welcome, I am glad you liked my video.

  • @leeeric6292
    @leeeric6292 ปีที่แล้ว +1

    Many thanks to your video, this TH-cam is valuable, so I read word by word carefully. And I find at 03:55, about the static variable, which is different from what you mentioned in your flvog (the link you provide in descriptions). In ur flvog, in para "where do static variable live", there you said static variables even if they are value types are not stored on the stack or the heap...need clarify? Thanks.

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว

      Thanks for spotting the discrepancy! I need to update my blog to make things clearer.
      Basically it is an implementation detail. In C# static variables are part of the MethodTables on the "High Frequency Heap". Which is a special part of the Heap memory for static variables and internal data structures.
      In C and C++ they are stored on the Data Segment, which is a special part of the memory for storing static variables and internal data structures.
      :) Sound familiar?
      If you look up Data Segment and High Frequency Heap they are both in the same place in memory. By the looks of things they are just slightly different implementations of the same thing.
      There is an old article here that explains it in depth:
      web.archive.org/web/20140724084944/msdn.microsoft.com/en-us/magazine/cc163791.aspx
      Jon Skeet also has a good article on it as well:
      jonskeet.uk/csharp/memory.html

    • @leeeric6292
      @leeeric6292 ปีที่แล้ว

      @@alexhyettdev Thanks for your response and your TH-cam.

  • @itsurguy7756
    @itsurguy7756 ปีที่แล้ว

    Hello sir at 3:20 in the video you say that in must run times there is a garbage collector that will clean the memory from the stored memory location after it has finished execution. Not sure if you know but with in C and C++ language we do not have a garbage collector I was told. So in C and C++ we delete pointers manually after block execution. So, Actually C and C++ are not garbage collecting languages.

  • @JanosTech
    @JanosTech ปีที่แล้ว

    Fantastic explanation, thanks mate!

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว

      You’re welcome! I am glad you liked it.

  • @tannguyen_91
    @tannguyen_91 11 หลายเดือนก่อน

    amazing, this help me understand everything

  • @satyabharadwaj7779
    @satyabharadwaj7779 8 หลายเดือนก่อน +1

    Asynchronous methods don't run on different threads. They run on a single thread but with a flexible event loop mechanism

  • @TheChyamp
    @TheChyamp ปีที่แล้ว +1

    Aren't static variables stored in the data segment? Not sure if any language stores static variables in the heap?

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว +1

      It seems to depend on the language. For C# they are stored in the heap from what i have read. C and C++ you right it is the data segment.

  • @ellisotoo
    @ellisotoo 10 หลายเดือนก่อน

    @4:23 what do you mean by the anonymous function is pushed on top of the stack and not have access to what previous level down? You mean even variables within main?

  • @iDeveloper92
    @iDeveloper92 ปีที่แล้ว

    Excellent breakdown!

  • @theEtch
    @theEtch 3 หลายเดือนก่อน

    thanks for the video. as a new programmer, the books analogy is great and helped me understand , but you could explain what is the meaning of static void Main(string[] args) and why this is relevant to the call stack, or what is a "call" exactly?

    • @theEtch
      @theEtch 3 หลายเดือนก่อน

      and I understand this is a java term, but would the same reasoning also apply in Python since it is interpreted and not compiled?

  • @juliaclaire68
    @juliaclaire68 ปีที่แล้ว

    thank you! very clear

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว

      You're welcome Julia, thank you for commenting.

  • @jesusromero9167
    @jesusromero9167 8 หลายเดือนก่อน

    Great explanation!

  • @ragtop63
    @ragtop63 ปีที่แล้ว

    Well done! Very good video.

  • @AXkj3mmy
    @AXkj3mmy ปีที่แล้ว

    Thank you! This was great

  • @younesmdarhrialaoui643
    @younesmdarhrialaoui643 ปีที่แล้ว

    Great explanation!

    • @alexhyettdev
      @alexhyettdev  ปีที่แล้ว

      Thanks! I’m glad it was helpful!