SlideShare a Scribd company logo
Stack and heap
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
Typing Speed
Week

Target Achieved

1

25

17
STACK & HEAP
Swafeena Nima KM
Swafeenanima @gmail.com
www.facebook.com/
Swafeenanima
twitter.com/username
in.linkedin.com/in/
Swafeenanima
9562852057
STACK
 The stack is a common data structure for representing things
 Need to maintained in a particular order
LIFO
STACK (contd..)
 Local variables are stored on the stack
 Stores temporary variables created by each function
 Often a function or method calls another function which in turn
calls another function etc
STACK (contd..)
 The stack has a fixed size
 Both stack and heap are store on the RAM
 If there is not enough space on the stack to handle the
memory being assigned to it, a stack overflow occurs
STACK (contd..)
Example For Stack overflow
#include <stdio.h>
int main()
{
int nStack[100000000];
return 0;
}
HEAP
 The heap is simply the memory used by programs to store
global variables
 Heap variables have no dependencies with each other and
can always be accessed randomly at any time
 Used for dynamic memory allocation
HEAP (contd..)
 It is a more free-floating region of memory (and is larger)
 To allocate memory  malloc() , calloc() or realloc()

 To deallocate memory  free() [Memory leak]
 Does not have size restrictions on variable size

 Heap memory is slightly slower to be read from and written to
STACK AND HEAP EXAMPLES
public void Method1()
{
int i=4;
int y=2;
class1 cls1 = new class1();
}
STACK AND HEAP EXAMPLES (contd..)
Stack and heap
If this presentation helped you, please visit our
page facebook.com/baabtra and like it.

Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com
Contact Us
Emarald Mall (Big Bazar Building)
Mavoor Road, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550

Start up Village
Eranakulam,
Kerala, India.
Email: info@baabtra.com

NC Complex, Near Bus Stand
Mukkam, Kozhikode,
Kerala, India.
Ph: + 91 – 495 40 25 550

More Related Content

Similar to Stack and heap (20)

PPTX
Functions with heap and stack
baabtra.com - No. 1 supplier of quality freshers
 
PDF
The value of reactive
Stéphane Maldini
 
PDF
The Value of Reactive
VMware Tanzu
 
PPT
scale_perf_best_practices
webuploader
 
PPTX
SAP ASE 16 SP02 Performance Features
SAP Technology
 
PPTX
20201010 - Collabdays 2020 - Sandro Pereira - Power Automates: best practice...
Sandro Pereira
 
PDF
distage: Purely Functional Staged Dependency Injection; bonus: Faking Kind Po...
7mind
 
PPT
Cloudera Impala Internals
David Groozman
 
ODP
PoC: Using a Group Communication System to improve MySQL Replication HA
Ulf Wendel
 
PPTX
Memory Allocation & Direct Memory Allocation in C & C++ Language PPT
AkhilMishra50
 
PDF
Fine-Tuning Large Language Models with Declarative ML Orchestration - Shivay ...
All Things Open
 
PDF
Noha mega store
Noha Elprince
 
PPT
Performance and Scalability
Mediacurrent
 
PDF
Availability in a cloud native world v1.6 (Feb 2019)
removed_414e600f33c7539c2e1b596a774aaebd
 
PDF
Caching principles-solutions
pmanvi
 
ODP
Caching and tuning fun for high scalability @ FrOSCon 2011
Wim Godden
 
PDF
Eugene Burmako
Volha Banadyseva
 
PDF
idea: talk about the Active Cache
Ching Yi Chan
 
PPTX
Low memory footprint programs-iSeries
Prithiviraj Damodaran
 
The value of reactive
Stéphane Maldini
 
The Value of Reactive
VMware Tanzu
 
scale_perf_best_practices
webuploader
 
SAP ASE 16 SP02 Performance Features
SAP Technology
 
20201010 - Collabdays 2020 - Sandro Pereira - Power Automates: best practice...
Sandro Pereira
 
distage: Purely Functional Staged Dependency Injection; bonus: Faking Kind Po...
7mind
 
Cloudera Impala Internals
David Groozman
 
PoC: Using a Group Communication System to improve MySQL Replication HA
Ulf Wendel
 
Memory Allocation & Direct Memory Allocation in C & C++ Language PPT
AkhilMishra50
 
Fine-Tuning Large Language Models with Declarative ML Orchestration - Shivay ...
All Things Open
 
Noha mega store
Noha Elprince
 
Performance and Scalability
Mediacurrent
 
Availability in a cloud native world v1.6 (Feb 2019)
removed_414e600f33c7539c2e1b596a774aaebd
 
Caching principles-solutions
pmanvi
 
Caching and tuning fun for high scalability @ FrOSCon 2011
Wim Godden
 
Eugene Burmako
Volha Banadyseva
 
idea: talk about the Active Cache
Ching Yi Chan
 
Low memory footprint programs-iSeries
Prithiviraj Damodaran
 

More from baabtra.com - No. 1 supplier of quality freshers (20)

PPTX
Agile methodology and scrum development
baabtra.com - No. 1 supplier of quality freshers
 
PDF
Acquiring new skills what you should know
baabtra.com - No. 1 supplier of quality freshers
 
PDF
Baabtra.com programming at school
baabtra.com - No. 1 supplier of quality freshers
 
PDF
99LMS for Enterprises - LMS that you will love
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 6 database normalisation
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 5 transactions and dcl statements
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 4 functions, views, indexing
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 3 stored procedures
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
Agile methodology and scrum development
baabtra.com - No. 1 supplier of quality freshers
 
Acquiring new skills what you should know
baabtra.com - No. 1 supplier of quality freshers
 
Baabtra.com programming at school
baabtra.com - No. 1 supplier of quality freshers
 
99LMS for Enterprises - LMS that you will love
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 6 database normalisation
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 5 transactions and dcl statements
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 4 functions, views, indexing
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
Ad

Recently uploaded (20)

PPTX
Latest Features in Odoo 18 - Odoo slides
Celine George
 
PDF
07.15.2025 - Managing Your Members Using a Membership Portal.pdf
TechSoup
 
PPTX
LEGAL ASPECTS OF PSYCHIATRUC NURSING.pptx
PoojaSen20
 
PPTX
Mrs Mhondiwa Introduction to Algebra class
sabinaschimanga
 
PPTX
Presentation: Climate Citizenship Digital Education
Karl Donert
 
PDF
Ziehl-Neelsen Stain: Principle, Procedu.
PRASHANT YADAV
 
PPTX
Gall bladder, Small intestine and Large intestine.pptx
rekhapositivity
 
PDF
BÀI TẬP BỔ TRỢ THEO LESSON TIẾNG ANH - I-LEARN SMART WORLD 7 - CẢ NĂM - CÓ ĐÁ...
Nguyen Thanh Tu Collection
 
PPTX
How to Define Translation to Custom Module And Add a new language in Odoo 18
Celine George
 
PPTX
GENERAL METHODS OF ISOLATION AND PURIFICATION OF MARINE__MPHARM.pptx
SHAHEEN SHABBIR
 
PPTX
ROLE OF ANTIOXIDANT IN EYE HEALTH MANAGEMENT.pptx
Subham Panja
 
PPT
digestive system for Pharm d I year HAP
rekhapositivity
 
PPTX
Various Psychological tests: challenges and contemporary trends in psychologi...
santoshmohalik1
 
PDF
TOP 10 AI TOOLS YOU MUST LEARN TO SURVIVE IN 2025 AND ABOVE
digilearnings.com
 
PPTX
IDEAS AND EARLY STATES Social science pptx
NIRANJANASSURESH
 
PPTX
PYLORIC STENOSIS: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
PPTX
Capitol Doctoral Presentation -July 2025.pptx
CapitolTechU
 
PPTX
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
PDF
IMP NAAC REFORMS 2024 - 10 Attributes.pdf
BHARTIWADEKAR
 
PDF
IMP NAAC-Reforms-Stakeholder-Consultation-Presentation-on-Draft-Metrics-Unive...
BHARTIWADEKAR
 
Latest Features in Odoo 18 - Odoo slides
Celine George
 
07.15.2025 - Managing Your Members Using a Membership Portal.pdf
TechSoup
 
LEGAL ASPECTS OF PSYCHIATRUC NURSING.pptx
PoojaSen20
 
Mrs Mhondiwa Introduction to Algebra class
sabinaschimanga
 
Presentation: Climate Citizenship Digital Education
Karl Donert
 
Ziehl-Neelsen Stain: Principle, Procedu.
PRASHANT YADAV
 
Gall bladder, Small intestine and Large intestine.pptx
rekhapositivity
 
BÀI TẬP BỔ TRỢ THEO LESSON TIẾNG ANH - I-LEARN SMART WORLD 7 - CẢ NĂM - CÓ ĐÁ...
Nguyen Thanh Tu Collection
 
How to Define Translation to Custom Module And Add a new language in Odoo 18
Celine George
 
GENERAL METHODS OF ISOLATION AND PURIFICATION OF MARINE__MPHARM.pptx
SHAHEEN SHABBIR
 
ROLE OF ANTIOXIDANT IN EYE HEALTH MANAGEMENT.pptx
Subham Panja
 
digestive system for Pharm d I year HAP
rekhapositivity
 
Various Psychological tests: challenges and contemporary trends in psychologi...
santoshmohalik1
 
TOP 10 AI TOOLS YOU MUST LEARN TO SURVIVE IN 2025 AND ABOVE
digilearnings.com
 
IDEAS AND EARLY STATES Social science pptx
NIRANJANASSURESH
 
PYLORIC STENOSIS: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
Capitol Doctoral Presentation -July 2025.pptx
CapitolTechU
 
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
IMP NAAC REFORMS 2024 - 10 Attributes.pdf
BHARTIWADEKAR
 
IMP NAAC-Reforms-Stakeholder-Consultation-Presentation-on-Draft-Metrics-Unive...
BHARTIWADEKAR
 
Ad

Stack and heap

  • 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
  • 4. STACK & HEAP Swafeena Nima KM Swafeenanima @gmail.com www.facebook.com/ Swafeenanima twitter.com/username in.linkedin.com/in/ Swafeenanima 9562852057
  • 5. STACK  The stack is a common data structure for representing things  Need to maintained in a particular order LIFO
  • 6. STACK (contd..)  Local variables are stored on the stack  Stores temporary variables created by each function  Often a function or method calls another function which in turn calls another function etc
  • 7. STACK (contd..)  The stack has a fixed size  Both stack and heap are store on the RAM  If there is not enough space on the stack to handle the memory being assigned to it, a stack overflow occurs
  • 8. STACK (contd..) Example For Stack overflow #include <stdio.h> int main() { int nStack[100000000]; return 0; }
  • 9. HEAP  The heap is simply the memory used by programs to store global variables  Heap variables have no dependencies with each other and can always be accessed randomly at any time  Used for dynamic memory allocation
  • 10. HEAP (contd..)  It is a more free-floating region of memory (and is larger)  To allocate memory  malloc() , calloc() or realloc()  To deallocate memory  free() [Memory leak]  Does not have size restrictions on variable size  Heap memory is slightly slower to be read from and written to
  • 11. STACK AND HEAP EXAMPLES public void Method1() { int i=4; int y=2; class1 cls1 = new class1(); }
  • 12. STACK AND HEAP EXAMPLES (contd..)
  • 14. If this presentation helped you, please visit our page facebook.com/baabtra and like it. Thanks in advance. www.baabtra.com | www.massbaab.com |www.baabte.com
  • 15. Contact Us Emarald Mall (Big Bazar Building) Mavoor Road, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550 Start up Village Eranakulam, Kerala, India. Email: [email protected] NC Complex, Near Bus Stand Mukkam, Kozhikode, Kerala, India. Ph: + 91 – 495 40 25 550