SlideShare uma empresa Scribd logo
1 de 9
Learn Microsoft Asp.Net
Garbage Collection
Visit: www.crbtech.in/Dot-Net-Training/
The main function of the garbage collector, as far as .NET framework is
concerned, is allocating and releasing the memory required for the application
to run. Whenever you define or create a new object, the .NET library better
known as the Common Language Runtime or CLR in short, is responsible for
assigning memory to the recently created object. The memory is borrowed from
the managed heap which can be called as an ocean of memory in layman’s
language. As far as this heap is available, the runtime library goes on to
allocate memory for newer objects created. One thing you must know as a
developer is that, the memory available is limited. After repeated use of it, the
garbage collector comes into the picture. It collects and frees the memory. The
optimizing engine decides the time for garbage collection and commands the
collector accordingly. The time is decided based on the memory allocations
made.
What the garbage collector does is that, it looks for those objects stored in the
memory that are no more in use. It does the necessary operation to free their
memory and make it available for further use.
Whether the application is a web based one or a windows based one; memory
allocation and management is vital and a cause of concern. Therefore, one can
say that the garbage collector performs a very important task as far as .NET
framework is concerned. Now let us see the advantages of garbage collector.
Advantages of Garbage Collector in .NET:
1.Makes memory allocation for objects from the available managed heap.
2.Ensures that one object does not occupy other one’s memory. Thus, keeping an
eye on memory safety and security.
3.We can continue to develop an application without worrying about whether
sufficient memory is available for developing and running it. Garbage collector will
take care of it at the back end.
4.Frees the memory of those objects that are not in use and makes it available for
allocation in the future.
How is Memory Allocated in Managed Heap?
For creating a new object, the new operator is used. This new operator ensures
that the required memory or space by the object is available in the reserved
region. It also commits the storage space if needed. If the space is optimum and
the object fits, then the object pointer points in the heap and the constructor is
given a call. The address of the object is thus fetched.
The heap or the managed heap is nothing but, a bunch of memory segments.
Each of them is of fixed size about 16MB. When memory is to be assigned to a
new object, the next memory location on the heap is allocated. If there is sufficient
memory available, then the collector is not called in. If not, the garbage collector
searches and frees the old dead objects in the heap. Then new object is allocated
memory.
Some Important Points About Garbage Collector:
1.Memory allocation is carried out within a contiguous range of addresses.
2.The segments are divided into Gen 0, Gen 1 and Gen 2. Gen 0 and Gen 1 form
ephemeral segment. Gen2 are the next segments. Large object heap are yet
another set of segments.
3.Older objects are situated at lower memory locations, while newer are present at
higher address locations.
4.On a regular basis, the heap is freed of garbage and memory is made available
for newer objects.
5.Objects are never separated by gaps in the memory.
This was the basic part of garbage collection in .NET.
Learn .net courses in pune to enhance your knowledge in dept.
Related articles:
Microsoft .Net Framework 4.0| 4.5 | 4.6 for Beginners
What is New About Open Source .Net?
THANK YOU…!

Mais conteúdo relacionado

Semelhante a Learn Microsoft Asp.Net Garbage Collection

Memory Leaks in Android Applications
Memory Leaks in Android ApplicationsMemory Leaks in Android Applications
Memory Leaks in Android ApplicationsLokesh Ponnada
 
Memory profiler and garbage collector in C#
Memory profiler and garbage collector in C#Memory profiler and garbage collector in C#
Memory profiler and garbage collector in C#Wipro
 
Garbage Collection, Tuning And Monitoring JVM In EBS 11i And R12
Garbage Collection, Tuning And Monitoring JVM In EBS 11i And R12Garbage Collection, Tuning And Monitoring JVM In EBS 11i And R12
Garbage Collection, Tuning And Monitoring JVM In EBS 11i And R12sidg75
 
Garbage collection
Garbage collectionGarbage collection
Garbage collectionMudit Gupta
 
Chapter 2 part 1
Chapter 2 part 1Chapter 2 part 1
Chapter 2 part 1rohassanie
 
02D-Memory Management in Java.pptx
02D-Memory Management in Java.pptx02D-Memory Management in Java.pptx
02D-Memory Management in Java.pptxAnhNhatNguyen5
 
Chronicles Of Garbage Collection (GC)
Chronicles Of Garbage Collection (GC)Chronicles Of Garbage Collection (GC)
Chronicles Of Garbage Collection (GC)Techizzaa
 
Garbage collection algorithms
Garbage collection algorithmsGarbage collection algorithms
Garbage collection algorithmsachinth
 
Is2215 lecture5 lecturer_g_cand_classlibraries
Is2215 lecture5 lecturer_g_cand_classlibrariesIs2215 lecture5 lecturer_g_cand_classlibraries
Is2215 lecture5 lecturer_g_cand_classlibrariesdannygriff1
 
Cache memory ppt
Cache memory ppt  Cache memory ppt
Cache memory ppt Arpita Naik
 
307d791b 3343-2e10-f78a-e1d50c7cf89a
307d791b 3343-2e10-f78a-e1d50c7cf89a307d791b 3343-2e10-f78a-e1d50c7cf89a
307d791b 3343-2e10-f78a-e1d50c7cf89avijaysrirams
 
01class_object_references & 02Generation_GC.pptx
01class_object_references & 02Generation_GC.pptx01class_object_references & 02Generation_GC.pptx
01class_object_references & 02Generation_GC.pptxssuser95922e
 
Why using finalizers is a bad idea
Why using finalizers is a bad ideaWhy using finalizers is a bad idea
Why using finalizers is a bad ideaPVS-Studio
 
Memory allocation for real time operating system
Memory allocation for real time operating systemMemory allocation for real time operating system
Memory allocation for real time operating systemAsma'a Lafi
 
Basic Garbage Collection Techniques
Basic  Garbage  Collection  TechniquesBasic  Garbage  Collection  Techniques
Basic Garbage Collection TechniquesAn Khuong
 
Vmreport
VmreportVmreport
Vmreportmeru2ks
 
Memory Management & Garbage Collection
Memory Management & Garbage CollectionMemory Management & Garbage Collection
Memory Management & Garbage CollectionAbhishek Sur
 
Heap Memory Management.pptx
Heap Memory Management.pptxHeap Memory Management.pptx
Heap Memory Management.pptxViji B
 
Profiler Guided Java Performance Tuning
Profiler Guided Java Performance TuningProfiler Guided Java Performance Tuning
Profiler Guided Java Performance Tuningosa_ora
 
Mule memory leak issue
Mule memory leak issueMule memory leak issue
Mule memory leak issueJeeHyunLim
 

Semelhante a Learn Microsoft Asp.Net Garbage Collection (20)

Memory Leaks in Android Applications
Memory Leaks in Android ApplicationsMemory Leaks in Android Applications
Memory Leaks in Android Applications
 
Memory profiler and garbage collector in C#
Memory profiler and garbage collector in C#Memory profiler and garbage collector in C#
Memory profiler and garbage collector in C#
 
Garbage Collection, Tuning And Monitoring JVM In EBS 11i And R12
Garbage Collection, Tuning And Monitoring JVM In EBS 11i And R12Garbage Collection, Tuning And Monitoring JVM In EBS 11i And R12
Garbage Collection, Tuning And Monitoring JVM In EBS 11i And R12
 
Garbage collection
Garbage collectionGarbage collection
Garbage collection
 
Chapter 2 part 1
Chapter 2 part 1Chapter 2 part 1
Chapter 2 part 1
 
02D-Memory Management in Java.pptx
02D-Memory Management in Java.pptx02D-Memory Management in Java.pptx
02D-Memory Management in Java.pptx
 
Chronicles Of Garbage Collection (GC)
Chronicles Of Garbage Collection (GC)Chronicles Of Garbage Collection (GC)
Chronicles Of Garbage Collection (GC)
 
Garbage collection algorithms
Garbage collection algorithmsGarbage collection algorithms
Garbage collection algorithms
 
Is2215 lecture5 lecturer_g_cand_classlibraries
Is2215 lecture5 lecturer_g_cand_classlibrariesIs2215 lecture5 lecturer_g_cand_classlibraries
Is2215 lecture5 lecturer_g_cand_classlibraries
 
Cache memory ppt
Cache memory ppt  Cache memory ppt
Cache memory ppt
 
307d791b 3343-2e10-f78a-e1d50c7cf89a
307d791b 3343-2e10-f78a-e1d50c7cf89a307d791b 3343-2e10-f78a-e1d50c7cf89a
307d791b 3343-2e10-f78a-e1d50c7cf89a
 
01class_object_references & 02Generation_GC.pptx
01class_object_references & 02Generation_GC.pptx01class_object_references & 02Generation_GC.pptx
01class_object_references & 02Generation_GC.pptx
 
Why using finalizers is a bad idea
Why using finalizers is a bad ideaWhy using finalizers is a bad idea
Why using finalizers is a bad idea
 
Memory allocation for real time operating system
Memory allocation for real time operating systemMemory allocation for real time operating system
Memory allocation for real time operating system
 
Basic Garbage Collection Techniques
Basic  Garbage  Collection  TechniquesBasic  Garbage  Collection  Techniques
Basic Garbage Collection Techniques
 
Vmreport
VmreportVmreport
Vmreport
 
Memory Management & Garbage Collection
Memory Management & Garbage CollectionMemory Management & Garbage Collection
Memory Management & Garbage Collection
 
Heap Memory Management.pptx
Heap Memory Management.pptxHeap Memory Management.pptx
Heap Memory Management.pptx
 
Profiler Guided Java Performance Tuning
Profiler Guided Java Performance TuningProfiler Guided Java Performance Tuning
Profiler Guided Java Performance Tuning
 
Mule memory leak issue
Mule memory leak issueMule memory leak issue
Mule memory leak issue
 

Último

Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 

Último (20)

Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 

Learn Microsoft Asp.Net Garbage Collection

  • 1. Learn Microsoft Asp.Net Garbage Collection Visit: www.crbtech.in/Dot-Net-Training/
  • 2. The main function of the garbage collector, as far as .NET framework is concerned, is allocating and releasing the memory required for the application to run. Whenever you define or create a new object, the .NET library better known as the Common Language Runtime or CLR in short, is responsible for assigning memory to the recently created object. The memory is borrowed from the managed heap which can be called as an ocean of memory in layman’s language. As far as this heap is available, the runtime library goes on to allocate memory for newer objects created. One thing you must know as a developer is that, the memory available is limited. After repeated use of it, the garbage collector comes into the picture. It collects and frees the memory. The optimizing engine decides the time for garbage collection and commands the collector accordingly. The time is decided based on the memory allocations made.
  • 3.
  • 4. What the garbage collector does is that, it looks for those objects stored in the memory that are no more in use. It does the necessary operation to free their memory and make it available for further use. Whether the application is a web based one or a windows based one; memory allocation and management is vital and a cause of concern. Therefore, one can say that the garbage collector performs a very important task as far as .NET framework is concerned. Now let us see the advantages of garbage collector.
  • 5. Advantages of Garbage Collector in .NET: 1.Makes memory allocation for objects from the available managed heap. 2.Ensures that one object does not occupy other one’s memory. Thus, keeping an eye on memory safety and security. 3.We can continue to develop an application without worrying about whether sufficient memory is available for developing and running it. Garbage collector will take care of it at the back end. 4.Frees the memory of those objects that are not in use and makes it available for allocation in the future.
  • 6. How is Memory Allocated in Managed Heap? For creating a new object, the new operator is used. This new operator ensures that the required memory or space by the object is available in the reserved region. It also commits the storage space if needed. If the space is optimum and the object fits, then the object pointer points in the heap and the constructor is given a call. The address of the object is thus fetched. The heap or the managed heap is nothing but, a bunch of memory segments. Each of them is of fixed size about 16MB. When memory is to be assigned to a new object, the next memory location on the heap is allocated. If there is sufficient memory available, then the collector is not called in. If not, the garbage collector searches and frees the old dead objects in the heap. Then new object is allocated memory.
  • 7. Some Important Points About Garbage Collector: 1.Memory allocation is carried out within a contiguous range of addresses. 2.The segments are divided into Gen 0, Gen 1 and Gen 2. Gen 0 and Gen 1 form ephemeral segment. Gen2 are the next segments. Large object heap are yet another set of segments. 3.Older objects are situated at lower memory locations, while newer are present at higher address locations. 4.On a regular basis, the heap is freed of garbage and memory is made available for newer objects. 5.Objects are never separated by gaps in the memory.
  • 8. This was the basic part of garbage collection in .NET. Learn .net courses in pune to enhance your knowledge in dept. Related articles: Microsoft .Net Framework 4.0| 4.5 | 4.6 for Beginners What is New About Open Source .Net?