Stack and Heap: Memory Management In Java (The most important Concept in Java)

Поділитися
Вставка
  • Опубліковано 17 гру 2024

КОМЕНТАРІ • 143

  • @bibekkumarbazaz647
    @bibekkumarbazaz647 4 роки тому +35

    The best video on memory management that I have come across. It gives a clear insight on how to write memory efficient code in Java.
    Will appreciate if you can make a video on streaming and how it works internally.
    Thanks a ton.

  • @GAGamingLegends
    @GAGamingLegends 3 роки тому +4

    This video deserves more likes and views 🙏

  • @techy0716
    @techy0716 3 роки тому +1

    Best illustrated concept of memory management in java

  • @TechWithChetann
    @TechWithChetann 4 роки тому +4

    Great explanation. I read that from Java 8 onwards the permgen has been removed. And instead of permgen we have a metaspace which is part of the native memory (which is not a heap memory) which is managed by the OS.

  • @ABAutomationHub
    @ABAutomationHub 2 роки тому +2

    Best content on memory management..Thanks for sharing!

    • @naveenautomationlabs
      @naveenautomationlabs  2 роки тому

      Thanks glad you liked it. Please refer the latest video on java memory management

  • @nandagopal375
    @nandagopal375 Рік тому +1

    Thank you provide valuable information about Java memory management 🙏🙏🙏

  • @WeWalkAI
    @WeWalkAI 5 років тому +1

    Great video. JVM understanding is important not only for interviews but far beyond interviews.

  • @ananthasubramanian7355
    @ananthasubramanian7355 4 роки тому +1

    Very good video....!! Crisp and Clear...!!! Thank you...!!

  • @akado5663
    @akado5663 6 років тому +5

    Thanks a lot Naveen. That was a Video which I was looking for it but never could find. Thanks for the excellent explanation.

  • @rachanabanerjee4696
    @rachanabanerjee4696 5 років тому +1

    One of the best tutors you are Naveen.

  • @niloybasu6508
    @niloybasu6508 3 роки тому +1

    Awesome explanation!!! Terrific!! Thanks a lot!!!

  • @MrSpraveennaika
    @MrSpraveennaika 2 роки тому +1

    My first nice video on Memory Management 👌👌

  • @praveenautomationinterview2367
    @praveenautomationinterview2367 7 років тому +7

    Hi Naveen,
    as always this is nice explanation!!
    Can we say that :Java Stack memory=Class (method) area+Native Method Stack+Variables memory area

  • @asimghosh5737
    @asimghosh5737 3 роки тому +1

    Very nice👍👍👍 it's really helpful.

  • @jalalzoon4447
    @jalalzoon4447 6 років тому

    Sir you have clear all concepts regarding java memory management. Thanks for your such great efforts in making video.

  • @avishsharma3404
    @avishsharma3404 3 роки тому

    Great Explanation , this is something that I found deepen understanding of memory management. Thanks Naveen

  • @prabhatpatnaik205
    @prabhatpatnaik205 4 роки тому +1

    really it is very nice video, after read this, I clear my concept on memory heap and stack. thank you navin.

  • @saikiran2356
    @saikiran2356 2 роки тому

    Kutha chimpi para dhengaw anna.... Mid nyt kuda chaala interesting ga chusaa

  • @Saravanans-q4e
    @Saravanans-q4e 10 місяців тому

    Great knowledge you having sir. Thanks for this .

  • @jaserq
    @jaserq 4 роки тому

    Just thank you.. i relieved finally.. i ve been seaching this for years !!!

  • @yashasvirallabandi9070
    @yashasvirallabandi9070 2 роки тому +1

    Great explanation. Thank you!

  • @meditationandrelaxationmus741
    @meditationandrelaxationmus741 5 років тому +1

    never found so detailed.... thanks a ton!

  • @abhijeets6593
    @abhijeets6593 4 роки тому +1

    Naveen, i want to add one point, permanent Generation is part of heap memory not stack memory as you said in video(28:03)

  • @saranthoughts9826
    @saranthoughts9826 9 місяців тому

    I am always follow your channel for java related , you rocking pls keep doing the good work. great sir!❤

  • @SeadoooRider
    @SeadoooRider 4 роки тому +1

    I really appreciate your effort Naveen. Thanks for video :)

  • @ramyapalani6760
    @ramyapalani6760 5 років тому

    Hats off sir..very good explanation..
    Pls continue this topic to cover garbage collection..

  • @madhulikaghosh3876
    @madhulikaghosh3876 6 років тому +2

    Thankyou Naveen. This was so informational

  • @parikshitraghav7543
    @parikshitraghav7543 5 років тому +3

    I Like your efforts Naveen, Very very useful video for interview (I was asked these questions in mine!).

  • @bollywoodtrailers7913
    @bollywoodtrailers7913 4 роки тому

    It was really a very explanatory session.
    Got all the concept by this vesio

  • @shipraparihar6963
    @shipraparihar6963 5 років тому +1

    Thanks Naveen for this amazing video. It is full of information and explained very clearly.

  • @_________________404
    @_________________404 4 роки тому +1

    Thanks, very interesting video. I just wanted to see what is the diference between local and static variable storage but I've learned much more.

  • @amanokuba4688
    @amanokuba4688 4 роки тому

    Nice explanation, thank you...As for the back ground noise, you could add a faint background music to cancel and soften the high pitch noise....

  • @jeet_upadhyaya
    @jeet_upadhyaya 3 роки тому

    Thankyou for this video Naveen!

  • @JaikratSinghTariyal
    @JaikratSinghTariyal 6 років тому +2

    Very good explanation. But this video is up to Java 7. Java 8 on wards, we dont have pergem concept at all. Its Metaspace now.

    • @MrVinnap
      @MrVinnap 6 років тому +1

      Jaikrat Singh Tariyal yes ... I was about to ask this questions. Now pergen is removed completely...

  • @AshutoshSingh-uc6nk
    @AshutoshSingh-uc6nk 3 роки тому +1

    Thankyou sir for this 🔥🔥🔥 explanation

  • @sourabhhsethii7292
    @sourabhhsethii7292 3 роки тому

    Thanks for sharing this knowledge!

  • @shashankjakhmola6226
    @shashankjakhmola6226 2 роки тому

    If Test t = new Test() is defined as instance variable rather then defined inside some method like m1 method. In that case I understood that new test() will be creating one object inside the heap. But where the reference will be stored as it is not local variable it is instance variable ? And stack will store local variable and local references as much as i know?

  • @Priya1_123
    @Priya1_123 4 роки тому

    Great and deep explanation and information in detail . Better than all other videos from other youtube channels.. Just a small suggestion, if the diagram is ready then this video can be covered in bit less time.Awesome video. Thanks a ton

  • @sreevanireddy1325
    @sreevanireddy1325 4 роки тому

    Every Nice explanation sir, it's very clear to understand. Thank you sir.

  • @aritrabhattacharya7722
    @aritrabhattacharya7722 2 роки тому

    This was really helpful. Thanks a lot.

  • @nalithamsaisudha
    @nalithamsaisudha 2 роки тому

    great explanation 👏

  • @dilipp007
    @dilipp007 6 років тому +1

    One of the survivor memories will always be free..

  • @GauravSingh-ov9mh
    @GauravSingh-ov9mh 7 років тому +3

    Great video. Just had a couple of query : 1. You said permgen is part of stack memory but you displayed them on separate boxes so that was confusing.
    2. You said stack size is very less compared to heap memory. but than what about Permgen (or now Metaspace) . Is metaspace is less compared to heap?
    Thanks!

  • @ahmadreza7508
    @ahmadreza7508 3 роки тому

    Thank you so much for creating such a helpful video

  • @faisalsakib9810
    @faisalsakib9810 6 років тому +1

    Thanks for such nice videos....can you please tell me after execution of a method... where the result is stored.???

  • @shijocg
    @shijocg 3 роки тому

    Very informative. I have one doubt why the survivor memory classified as two, both have same usage and purpose?

  • @swapnilgupta6028
    @swapnilgupta6028 6 років тому +1

    Thank you so much Naveen but one Question, Cam you tell from which book you took reference ?

  • @sureshgply
    @sureshgply 6 років тому

    Very good explanation for Memory management. Thanks Naveen

  • @ayyapareddykandula8481
    @ayyapareddykandula8481 5 років тому +1

    Excellent sir, thanks for the video

  • @bopon4090
    @bopon4090 4 роки тому

    Awesome video. I have one question do i need to run manual gc?

  • @arijitbasu4397
    @arijitbasu4397 3 роки тому

    Such a quality content ❤️

  • @mallikarjun-shurpali9698
    @mallikarjun-shurpali9698 2 роки тому

    Nice explanation sir..

  • @dupindersingh1599
    @dupindersingh1599 3 роки тому

    Question 1:
    At the time of Major GC, will the JRE do only Major GC ? or JRE will perform its normal tasks and in parallel Major GC will perform
    Question 2:
    When you said we don't have to do the Major GC frequently, is there any code we write explicitly for GC? I think JRE itself take care of the Garbage collection.

  • @supriyakumari8552
    @supriyakumari8552 3 роки тому

    great information, fine details. :)

  • @SureshKumar-ul5ev
    @SureshKumar-ul5ev 5 років тому +1

    Custom immutable store into which part of memory?

  • @mugeeshhk
    @mugeeshhk 3 роки тому

    As per my understanding,
    1. So at a time, one of the survivor space is always empty ? this correct ?
    2. Objects that are survived after many cycles of GC, are moved to the Old generation memory space ?

  • @RoshniGupta-bl6ex
    @RoshniGupta-bl6ex 4 роки тому

    Hi Naveen,
    Very well explained! Can we get the pictorial view of this concept as explained in the video?

    • @naveenautomationlabs
      @naveenautomationlabs  4 роки тому

      Thanks for watching! But what do you mean by pictorial view of this concept?

  • @prapasup
    @prapasup 5 років тому +1

    Thanks much for sharing the information.

  • @chigullapallysaiprasad6395
    @chigullapallysaiprasad6395 6 років тому +1

    Naveen ji extraordinary teaching thanks a lot for sharing your great knowledge please help in sql concepts as well.

  • @vijayragavendran5606
    @vijayragavendran5606 5 років тому

    This is perfect! Great job man ! Thanks a lot!

  • @narainsankar
    @narainsankar 3 роки тому

    Great explanation..

  • @nishant2242
    @nishant2242 2 роки тому

    Great explanation

  • @somias1575
    @somias1575 4 роки тому

    Hi Naveen, one query on method block. You said one method at a time is given space inside it. But let's say we have a main method which calls another method inside it. How is this scenario handled?

  • @shashankjakhmola6226
    @shashankjakhmola6226 2 роки тому

    Memory leak will come on only in heap area right? If yes then in that case what we need to do in that case?

  • @kunalsinha5942
    @kunalsinha5942 3 роки тому

    Thanks Naveen for such a informative video. I have a follow up question below:-
    If we create any Collection I.e Arraylist , Hashmap etc .. where is it created .. in Heap or Stack?Since collections stores the the object references rather than physical objects..How does it manage the whole process?

  • @rajajain786
    @rajajain786 3 роки тому

    Hi Naveen, just want to know each application create own JRE on server memory? also what is difference between JVM and JMM?

  • @dinkarinjosh
    @dinkarinjosh 5 років тому

    Any suggestion of a book for further reading and understanding this?

  • @zajuzam
    @zajuzam 2 роки тому

    Nice Explanation

  • @livefantastic2442
    @livefantastic2442 6 років тому

    very nice video. one question i had, corresponding to each thread is there a separate stack bcoz in case of multiple threads multiple functions may execute simultaneously thus each method need a method block. Though in a particular thread only one method will execute at a time.

  • @aritrabhattacharya7722
    @aritrabhattacharya7722 2 роки тому

    Hello Sir, I have some questions:
    So where exactly are new Strings stored (in heap or in stringpool directly)? And where is the stringpool located then (method area of permgen or heap)? There has been some changes in Java 7 and 8 to the permgen section. When does a string automatically move to striingpool provided intern methos is not called.
    Thanks in advance :)

  • @ShubhamGupta-du6ie
    @ShubhamGupta-du6ie 3 роки тому

    Hi Naveen, How to perform GC for a particular object

  • @dinkarinjosh
    @dinkarinjosh 5 років тому

    if Method block is used one by one by the methods being executed, what will happen if one method1 calls another method2 and method2 returns something to method1, at this time both the methods are executing (pseudo parallelly)?

  • @sudhirDubey-g3g
    @sudhirDubey-g3g 10 місяців тому

    how you differing method block and method area of Permanent generation.

  • @RanjithKumar-qj9mn
    @RanjithKumar-qj9mn 4 роки тому

    Thanks Naveen . I have a question is premgen is also part of stack memory

  • @nikhilgupta6564
    @nikhilgupta6564 6 років тому +1

    Very well explained .. Concise and clear .. Pls keep uploading more videos on JAVA

  • @shubhamtripathi6536
    @shubhamtripathi6536 5 років тому

    which method block is stored in stack in case of method overriding?

  • @shashankjakhmola6226
    @shashankjakhmola6226 2 роки тому

    As much as i have a knowledge till now permanent generation is separate memory are and stack is separate memory area . But in this video somewhere at the end you are saying parmanent memory is part of stack memory which is making me confused can you please explain on that ? Is both separate memory area or parmanent is part of stack. ?

  • @rafiq41cb
    @rafiq41cb 2 роки тому

    If m1 calls m2, method block will be available to which method?

  • @sancharidas7532
    @sancharidas7532 3 роки тому

    What are JRE classes? The predefined classes or the ones which I have made ?? Someone help me understand please.

  • @AhmedKhaled-he9mf
    @AhmedKhaled-he9mf 3 роки тому

    very very nice explain
    I become subscriber because this video

  • @ThishK
    @ThishK 7 років тому

    Great one!! One question to you Naveen. Do you know how to perform test for the product (Web based Game) where DOM element is hidden. I think all the DOM element is under the CANVAS?

  • @princekumar764
    @princekumar764 6 років тому

    one word....AWESOME

  • @khajazakiuddin931
    @khajazakiuddin931 5 років тому

    u really make it simple naveen... 😊...i still like ur amazing diagrammatic representation of concepts which make things really easy to understand...kudos bro... keep going...👏🙂

  • @gyaraganesh7020
    @gyaraganesh7020 5 років тому

    sir , your explanation is very nice
    and make more videos
    thanking you very much sir

  • @shankardayal6928
    @shankardayal6928 3 роки тому

    PermGen was part of Heap upto java 8.
    From java 8, it had been removed.

  • @anushree3744
    @anushree3744 4 роки тому

    Hi naveen, thanks for the detailed explanation.
    I have a question.
    Where are the instance variables, argument to the constructor, if any object is created inside the constructor, where is the reference var stored?
    I was asked in an interview and I flunked 😒

  • @RajanGupta-jf5mn
    @RajanGupta-jf5mn 4 роки тому

    Nice Naveen, very informative. :) by any chance any plans for a video explaining the metaspace concept also?

  • @ankit9953817851
    @ankit9953817851 5 років тому

    What if the reference variable is a class instance variable and NOT a method local variable? I believe in that case, the reference variable is stored along with the object of that class and NOT on stack. Please correct me if I'm wrong.

  • @saraswathib9889
    @saraswathib9889 6 років тому +1

    Small correction in your lesson
    When the survivor space S0 is filled, it automatically goes to Old Generation after the minor GC. It will not go to S1.

  • @pragadees24
    @pragadees24 7 років тому +1

    Very Good One:) got some more Idea about JRE.

  • @arvindmv7166
    @arvindmv7166 3 роки тому

    Very informative, but I was looking for information regarding MetaSpace.

  • @apoorvdixit2856
    @apoorvdixit2856 4 роки тому

    sir can we say that each class have only one object and rest are created by referenced to that object.

  • @GurubabuJampala
    @GurubabuJampala 5 років тому

    Memory Pool (Constant Pool) memory is available in Young Generation or Old Generation?

  • @sagars3332
    @sagars3332 3 роки тому

    Hi sir I have one doubt,let say if older generations is also filled with objects and there is not enough space then if GC destroy that object wouldn't it impcact the application as the object is no longer available...sir I am starter guy pardon me if I sound stupid..

  • @nikhilkhatri1417
    @nikhilkhatri1417 5 років тому

    Very informative and nicely presented. Just the keyboard noise is lill irretating.
    Please upload any video on Class loading with context of JRE.

  • @kamnijaiswal8060
    @kamnijaiswal8060 4 роки тому

    Permanent Generation is also part of Heap memory.

  • @arunnagarindia
    @arunnagarindia 5 років тому

    Hi Naveen,
    My Java application reads file and stores to DB.for this it takes 3GB space.but after completion of program GC is not clearing the space, application still takes 3GB space.how to free up the space??

  • @seshareddy7254
    @seshareddy7254 7 років тому

    Hi Naveen, Can you please make an video on difference between String,String Buffer and Sting Builder (Differenace bewtween Mutable and immutable )

  • @svecww
    @svecww 3 роки тому +1

    Thanku sir can u please share if u have any notes?

  • @nutandas7828
    @nutandas7828 4 роки тому

    PermGen is replaced with metaspace after java 8 with better memory management and growable feature.

    • @naveenautomationlabs
      @naveenautomationlabs  4 роки тому

      Yes it got covered and updated ib this video: ua-cam.com/video/4yKxJjYXZ0A/v-deo.html