Stack vs Heap Memory in Java

preview_player
Показать описание
#java #telusko #javadeveloper #stackvsheap #navinreddy
Рекомендации по теме
Комментарии
Автор

Love this series, please continue it sir please sir🙏🙏🙏

neerajslab
Автор

Excellent sir, i love your explanation already and adding visualisation like this is next level ❤️😍

commenter
Автор

There is also a third type of memory area - native memory. It’s not managed by garbage collector, so you must explicitly allocate and de allocate it. It is useful for some use scenarios like communicating with external processes or even hardware API. For example, before sending data to the GPU, you must put it into native memory. And one last point: Stack space is local per thread, while the Heap space is shared between threads

kostiapereguda
Автор

Excellent sir, i love the way you teach...keep it up.

anshukumarpandey
Автор

I think static variables in method area, instance variables In heap area & local variables in stack area...

manideeppagadala
Автор

Sir please do a video on new garbage collector.

sdash
Автор

Hi Naveen,

Do the reels on python programming.
It is very helpful for us for coding and interview perspectives.

Naga
Автор

So where does the object reference variable goes?

aalsee
Автор

Or baki languages main memory kaise located hoti hai? 🙃

leeqa
Автор

HAI SIR GIVE SOME INFORMATION ABOUT DSA BY JAVA

sureshsanka
Автор

Any practical proof to show heap and stack as memory??

Theories says there is stack memory and heap memory .... No one ever tell and show yes its not only concept it's there see

ankitshukla
Автор

Where on physical devices these Stack and Heap exist..?

meabhinav
Автор

What's the point of talking about stacks and heaps in java? You cannot create objects on the stack and I don't see the need to learn this for java.

leonardschungel
Автор

I'm going to help somebody out (so a smart 10 year old can memorize something). Stack and Heap are slang vocabulary which is used in popular teaching methods and lessons.

Stack is memory called [ cpu cache ] which is a literal circuit that is microscopically soldered closest to the registers (or processor). Some CPU processors have L1, L2, and L3 cache. The Cache or Stack is why AMD is winning right now on every new Epyc, ThreadRipper, and Ryzen processors. AMD keeps increasing cache|stack. I have EPYC that can store a whole computer operating system in one core (and Epyc has 64 cores (which is like 64 computers on one chip)).

The Heap is the memory stored on the RAM sticks. RAM is considered the second fastest memory device in the computer (but it has a slower time or latency or CAS (when compared to cache|stack). Swap space is when you run out of RAM and your memory mapper starts writing data pages to disk. Traditionally, the function ARGV list and any time you use the keyword [ var ] or [ static ] or [ final ] is supposed to create|write|read a stack variable (but that falls apart in java). The keyword [ new ] is supposed to store|write|read data to heap. Java's virtual machine used to be true to that design. It stopped being true once the Java Designers started d1ck1n6 around with the Garbage Collection and Memory Management. So now Java memory management internally declares variables on the stack (sometimes) but the values are stored in heap (sometimes). Its a f4ck1n6 nightmare. You eventually need a memory profiler to tell you when the stack or heap is running out of free space (since you have zero control on where stuff goes).

James Gosling did not want people choosing when to grab memory from one of those devices, so he hid and made confusions to where which variables, keywords, and syntax use the stack or heap or paging to disk. Now there is a long unknown list of what objects use stack or heap. You never truly know. Then the Java Gods might change it every year in whatever JRE version. So keeping up with java is more about knowing which keywords and object types uses which memory devices. Your salary usually increases when your puny human brain can memorize which java libraries and objects use what memory devices.

Lets face it, java is not used by rockstar programmers. Its more of a corporation tool used to create more problems that force customers to throw more money at Java companies to fix things. The more problems, the more money. The client needs to pay more money, so they can get a senior developer to actually solve problems. Java was invented to force people to pay for more RAM (or memory).

complexity
visit shbcf.ru