SlideShare uma empresa Scribd logo
1 de 14
Disclaimer: This presentation is prepared by
trainees of baabtra as a part of mentoring
program. This is not official document of baabtra –
Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System
Technologies Pvt . Ltd
HEAP AND STACK

       vishnu.padinjattedath@gmail.com
                        @Vishnu_Kishor
BASICS
• 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.
• Of all of the above 4 sections, you need to
  understand the allocation of memory in Stack
  & Heap the most, since it will affect your
  programming efforts.
Difference between instance variables
          and local variables
• Instance variables are declared inside a class
  but not inside a method

     class Student{
     <strong>int num; // num is  instance
                            variable</strong>
     public void showData{}
• Local variables are declared inside a method
  including method arguments.
     1public void sum(int a)
     {
     int x = int a + 3;
     // a , x are local variables</strong>
     }
VARIABLE DECLARATION
• Allocation of some RAM memory to variable.
• Three aspects saved in memory
  – the name of the variable,
  – the data type of the variable and
  – the value of the variable.
STACK : DEFENITION
• The Stack section contains
  – methods,
  – local variables and
  – reference variables.
• The info: required to resume the execution of
  these functions is stored in the stack.
• Provides static memory allocation
HEAP : DEFENITION
• The memory used by programs to store global
  variables.
• All global variables are stored in heap memory
• When that function exits, the heap memory
  used by each local variable is freed.
• Dynamic memory allocation
Thank you
Did this presentation help you??? do visit our
 page facebook.com/baabtra and like us.

www.baabtra.com |
www.massbaab.com |
www.baabte.com |
Contact Us

Mais conteúdo relacionado

Destaque (13)

Logical reasoning
Logical reasoningLogical reasoning
Logical reasoning
 
HR questions
HR questionsHR questions
HR questions
 
Datatypes slide
Datatypes slideDatatypes slide
Datatypes slide
 
Double entrybookkeepingsystem
Double entrybookkeepingsystemDouble entrybookkeepingsystem
Double entrybookkeepingsystem
 
Inheritance
InheritanceInheritance
Inheritance
 
Logical Reasoning
Logical ReasoningLogical Reasoning
Logical Reasoning
 
Server side scripting
Server side scriptingServer side scripting
Server side scripting
 
Lluerna 09, juliol 2012
Lluerna 09, juliol 2012Lluerna 09, juliol 2012
Lluerna 09, juliol 2012
 
Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
Cynogen mod
Cynogen modCynogen mod
Cynogen mod
 
Method overloading
Method overloadingMethod overloading
Method overloading
 
ORDBMS
ORDBMSORDBMS
ORDBMS
 
Global Distribution System
Global Distribution SystemGlobal Distribution System
Global Distribution System
 

Semelhante a Stack n heap (20)

Stack and Heap
Stack and HeapStack and Heap
Stack and Heap
 
Stack&heap
Stack&heapStack&heap
Stack&heap
 
Stack and heap
Stack and heapStack and heap
Stack and heap
 
STORAGE CLASS.pptx
STORAGE CLASS.pptxSTORAGE CLASS.pptx
STORAGE CLASS.pptx
 
Lecture 15 run timeenvironment_2
Lecture 15 run timeenvironment_2Lecture 15 run timeenvironment_2
Lecture 15 run timeenvironment_2
 
Memory Allocation & Direct Memory Allocation in C & C++ Language PPT
Memory Allocation & Direct Memory Allocation in C & C++ Language PPTMemory Allocation & Direct Memory Allocation in C & C++ Language PPT
Memory Allocation & Direct Memory Allocation in C & C++ Language PPT
 
C MEMORY MODEL​.pptx
C MEMORY MODEL​.pptxC MEMORY MODEL​.pptx
C MEMORY MODEL​.pptx
 
C MEMORY MODEL​.pptx
C MEMORY MODEL​.pptxC MEMORY MODEL​.pptx
C MEMORY MODEL​.pptx
 
C interview Q&A (2)
C interview Q&A (2)C interview Q&A (2)
C interview Q&A (2)
 
Distributed applications using Hazelcast
Distributed applications using HazelcastDistributed applications using Hazelcast
Distributed applications using Hazelcast
 
Web Technology Part 2
Web Technology Part 2Web Technology Part 2
Web Technology Part 2
 
4 memory management bb
4   memory management bb4   memory management bb
4 memory management bb
 
Functions
FunctionsFunctions
Functions
 
COMPILER DESIGN Run-Time Environments
COMPILER DESIGN Run-Time EnvironmentsCOMPILER DESIGN Run-Time Environments
COMPILER DESIGN Run-Time Environments
 
JVM
JVMJVM
JVM
 
Unit 5
Unit 5Unit 5
Unit 5
 
Functions with heap and stack
Functions with heap and stackFunctions with heap and stack
Functions with heap and stack
 
Abap top part_3
Abap top part_3Abap top part_3
Abap top part_3
 
Run time administration
Run time administrationRun time administration
Run time administration
 
Complete PPT about the Java lokesh kept it
Complete PPT about the Java lokesh kept itComplete PPT about the Java lokesh kept it
Complete PPT about the Java lokesh kept it
 

Mais de baabtra.com - No. 1 supplier of quality freshers

Mais de baabtra.com - No. 1 supplier of quality freshers (20)

Agile methodology and scrum development
Agile methodology and scrum developmentAgile methodology and scrum development
Agile methodology and scrum development
 
Best coding practices
Best coding practicesBest coding practices
Best coding practices
 
Core java - baabtra
Core java - baabtraCore java - baabtra
Core java - baabtra
 
Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php sessions & cookies
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 3 stored procedures
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Microsoft holo lens
 
Blue brain
Blue brainBlue brain
Blue brain
 
5g
5g5g
5g
 
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Aptitude skills baabtra
 
Gd baabtra
Gd baabtraGd baabtra
Gd baabtra
 

Stack n heap

  • 1.
  • 2. Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra – Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  • 3. HEAP AND STACK vishnu.padinjattedath@gmail.com @Vishnu_Kishor
  • 4. BASICS • The JVM divided the memory into following sections. – Heap – Stack – Code – Static • This division of memory is required for its effective management
  • 5. • 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.
  • 6. • Of all of the above 4 sections, you need to understand the allocation of memory in Stack & Heap the most, since it will affect your programming efforts.
  • 7. Difference between instance variables and local variables • Instance variables are declared inside a class but not inside a method class Student{ <strong>int num; // num is instance variable</strong> public void showData{}
  • 8. • Local variables are declared inside a method including method arguments. 1public void sum(int a) { int x = int a + 3; // a , x are local variables</strong> }
  • 9. VARIABLE DECLARATION • Allocation of some RAM memory to variable. • Three aspects saved in memory – the name of the variable, – the data type of the variable and – the value of the variable.
  • 10. STACK : DEFENITION • The Stack section contains – methods, – local variables and – reference variables. • The info: required to resume the execution of these functions is stored in the stack. • Provides static memory allocation
  • 11. HEAP : DEFENITION • The memory used by programs to store global variables. • All global variables are stored in heap memory • When that function exits, the heap memory used by each local variable is freed. • Dynamic memory allocation
  • 13. Did this presentation help you??? do visit our page facebook.com/baabtra and like us. www.baabtra.com | www.massbaab.com | www.baabte.com |