
Memory Management & GC
Garbage Collection, generations, finalization, IDisposable, using statement, memory leaks, profiling
1What is the Garbage Collector (GC) in .NET?
What is the Garbage Collector (GC) in .NET?
Câu trả lời
The Garbage Collector is an automatic memory management mechanism that frees unused objects on the managed heap. It runs automatically in the background to prevent memory leaks, unlike C/C++ where memory must be manually freed. The GC analyzes object references and collects those that are no longer accessible from application roots.
2What are the three generations of the Garbage Collector in .NET?
What are the three generations of the Garbage Collector in .NET?
Câu trả lời
The .NET GC uses three generations: Gen0 (young, short-lived objects, collected frequently), Gen1 (medium lifetime objects, buffer zone between Gen0 and Gen2), and Gen2 (long-lived objects, collected rarely as it's expensive). This generational system optimizes performance by first collecting ephemeral objects (Gen0) which represent 80-90% of objects, while avoiding frequent scanning of persistent objects (Gen2).
3What is the Large Object Heap (LOH) in .NET?
What is the Large Object Heap (LOH) in .NET?
Câu trả lời
The Large Object Heap is a separate memory space for objects of 85 KB or larger, logically belonging to Gen2. Unlike the standard heap which is regularly compacted, the LOH is NOT compacted by default to avoid the cost of copying large objects. This can cause memory fragmentation. Since .NET 4.5.1, LOH compaction can be manually enabled with GCSettings.LargeObjectHeapCompactionMode.
What is the role of the IDisposable pattern in .NET?
What does the using statement do in C#?
+19 câu hỏi phỏng vấn
Các chủ đề phỏng vấn .NET khác
C# Basics
LINQ & Delegates
C# Language Essentials
ASP.NET Core Fundamentals
ASP.NET Core Request Lifecycle
Configuration & Settings
Application Lifecycle
Dependency Injection
Entity Framework Core
Minimal APIs
Web API Development
Async in ASP.NET Core
Authentication & Authorization
HttpClient & Networking
JSON Serialization
Entity Framework Core Advanced
C# Advanced Features
Clean Architecture
Logging, Monitoring & Observability
Unit Testing & xUnit
Integration Testing
Docker & Containerization
NuGet Package Management
Reactive Programming
Async/await & Patterns
.NET Design Patterns
Performance Optimization
Security & Best Practices
SignalR & Real-time
Microservices Architecture
Nắm vững .NET cho lần phỏng vấn tiếp theo
Truy cập tất cả câu hỏi, flashcards, bài kiểm tra kỹ thuật, bài tập code review và mô phỏng phỏng vấn.
Bắt đầu miễn phí