10th Day @ Noida: Stack and Heap

Hi Readers!

I have come to know about heap and stack today which was amazing.

Heap and Stack Memory in Java Program

What is Stack Memory?
Stack in java is a section of memory which contains methods, local variables, and reference variables. Stack memory is always referenced in Last-In-First-Out order. Local variables are created in the stack.

What is Heap Memory?
Heap is a section of memory which contains Objects and may also contain reference variables. Instance variables are created in the heap.

Memory Allocation in Java
The JVM divided the memory into following sections.

Heap
Stack
Code
Static
This division of memory is required for its effective management.

The code section contains your bytecode.
The Stack section of memory contains methods, local variables, and reference variables.
The Heap section contains Objects (may also contain reference variables).
The Static section contains Static data/methods.

Comments

Popular posts from this blog

How to add Internet download manager extension in the Chrome browser

A Day in Noida: Learning Begins

Python Deciding factor