Welcome
• Disclaimer:This presentation is prepared by trainees of  baabtra as a part of mentoring program. This is not  official d...
Stack and heap     Ashwin Anand V     Email:ashwinanand99@gmail.com     Facebook id:ashwinanand99@gmail.com
Difference between instance    variables and local variables• Instance variables are declared inside a class but not   ins...
What goes inside when you       declare a variable?• When you declare a variable in a application, it  allocates some chun...
STACK• The Stack section of memory contains methods,  local variables and reference variables.• All the information requir...
HEAP• The heap is simply the memory used by programs  to store global variables.• All global variables are stored in heap ...
Example for stack and heappublic void Method() {int i=4;   (stack memory) int y=2    (stack memory)Class1 cls1= new class(...
Example cont….
• If this presentation helped you, please visit  our page facebook.com/baabtra and like it.  Thanks in advance.• www.baabt...
Thank you
Stack and Heap
Upcoming SlideShare
Loading in...5
×

Stack and Heap

236

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
236
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
8
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Stack and Heap

  1. 1. Welcome
  2. 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. 3. Stack and heap Ashwin Anand V Email:ashwinanand99@gmail.com Facebook id:ashwinanand99@gmail.com
  4. 4. Difference between instance variables and local variables• Instance variables are declared inside a class but not inside a method:class Student{int num; // num is instance variablepublic void showData{}• Local variables are declared inside a method including method arguments:public void sum(int a){int x = int a + 3; // a , x are local variables•• }
  5. 5. What goes inside when you declare a variable?• When you declare a variable in a application, it allocates some chunk of memory in the RAM.• This memory has three things: the name of the variable, the data type of the variable, and the value of the variable.
  6. 6. STACK• The Stack section of memory contains methods, local variables and reference variables.• All the information required to resume the execution of these functions is stored on the stack.• Provides static memory allocation
  7. 7. HEAP• The heap is simply 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 .
  8. 8. Example for stack and heappublic void Method() {int i=4; (stack memory) int y=2 (stack memory)Class1 cls1= new class(); (heap memory)}
  9. 9. Example cont….
  10. 10. • If this presentation helped you, please visit our page facebook.com/baabtra and like it. Thanks in advance.• www.baabtra.com | www.massbaab.com |ww w.baabte.com
  11. 11. Thank you
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×