---
title: "What is a memory leak in .NET and how can it happen despite GC?"  
description: "What is a memory leak in .NET and how can it happen despite GC?"  
author: "Ponu Maurya"  
published: 2025-06-23  
updated: 2025-06-23  
canonical: https://www.mindstick.com/interview/34278/what-is-a-memory-leak-in-dot-net-and-how-can-it-happen-despite-gc  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# What is a memory leak in .NET and how can it happen despite GC?

**Answer:**\
A memory leak occurs when memory that’s no longer needed is not released.

## Causes:

- Event handlers not unsubscribed (strong references remain).
- Static fields holding object references.
- Caching patterns without eviction.
- Disposables not disposed.

**Tools**: Use **dotMemory**, **PerfView**, **dotTrace**, or **Visual Studio Diagnostics Tools**.

## Answers

### Answer by Ponu Maurya

**Answer:**\
A memory leak occurs when memory that’s no longer needed is not released.

## Causes:

- Event handlers not unsubscribed (strong references remain).
- Static fields holding object references.
- Caching patterns without eviction.
- Disposables not disposed.

**Tools**: Use **dotMemory**, **PerfView**, **dotTrace**, or **Visual Studio Diagnostics Tools**.


---

Original Source: https://www.mindstick.com/interview/34278/what-is-a-memory-leak-in-dot-net-and-how-can-it-happen-despite-gc

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
