# Memory Management & GC (.NET) > Garbage Collection、世代、ファイナライゼーション、IDisposable、using ステートメント、メモリリーク、プロファイリング - 22 面接問題 - Senior - [面接問題: .NET](https://sharpskill.dev/ja/technologies/dotnet/interview-questions.md) ## 1. .NET における Garbage Collector (GC) とは何ですか? **回答** Garbage Collector は、managed heap 上の未使用オブジェクトを解放する自動メモリ管理の仕組みです。メモリを手動で解放する必要がある C/C++ とは異なり、メモリリークを防ぐためにバックグラウンドで自動的に実行されます。GC はオブジェクトの参照を分析し、アプリケーションの root から到達できなくなったオブジェクトを回収します。 ## 2. .NET の Garbage Collector における 3 つの世代とは何ですか? **回答** .NET の GC は 3 つの世代を使用します。Gen0(新しく短命なオブジェクト、頻繁に回収される)、Gen1(中程度の寿命のオブジェクト、Gen0 と Gen2 の間のバッファ領域)、Gen2(長寿命のオブジェクト、コストが高いためまれにしか回収されない)です。この世代別システムは、オブジェクトの 80~90% を占める短命なオブジェクト(Gen0)を最初に回収し、永続的なオブジェクト(Gen2)の頻繁なスキャンを避けることでパフォーマンスを最適化します。 ## 3. .NET における Large Object Heap (LOH) とは何ですか? **回答** Large Object Heap は 85 KB 以上のオブジェクトのための独立したメモリ空間で、論理的には Gen2 に属します。定期的にコンパクションされる標準ヒープとは異なり、LOH は大きなオブジェクトをコピーするコストを避けるためデフォルトではコンパクションされません。これによりメモリの断片化が発生する可能性があります。.NET 4.5.1 以降では、GCSettings.LargeObjectHeapCompactionMode を使って LOH のコンパクションを手動で有効化できます。 ## さらに19問利用可能 - .NET における IDisposable パターンの役割は何ですか? - C# の using ステートメントは何をしますか? 無料で登録: https://sharpskill.dev/ja/login ## その他の.NET面接トピック - [C# の基礎](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/csharp-basics.md): 25問, Junior - [LINQ & Delegates](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/csharp-linq-delegates.md): 20問, Junior - [C#言語の基礎](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/csharp-language-essentials.md): 15問, Junior - [ASP.NET Core の基礎](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/aspnet-core-fundamentals.md): 18問, Junior - [ASP.NET Core のリクエストライフサイクル](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/aspnet-core-request-lifecycle.md): 20問, Junior - [Configuration & Settings](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/configuration-settings.md): 20問, Junior - [アプリケーションのライフサイクル](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/application-lifecycle.md): 20問, Junior - [Dependency Injection](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/dependency-injection.md): 24問, Mid-Level - [Entity Framework Core](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/entity-framework-core.md): 25問, Mid-Level - [Minimal APIs](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/minimal-apis.md): 18問, Mid-Level - [Web API開発](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/web-api-development.md): 22問, Mid-Level - [ASP.NET Core における Async](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/async-aspnet-core.md): 20問, Mid-Level - [Authentication & Authorization](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/authentication-authorization.md): 18問, Mid-Level - [HttpClient & ネットワーキング](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/httpclient-networking.md): 20問, Mid-Level - [JSONシリアライズ](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/json-serialization.md): 20問, Mid-Level - [Entity Framework Core 応用](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/ef-core-advanced.md): 25問, Mid-Level - [C# の高度な機能](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/csharp-advanced-features.md): 20問, Mid-Level - [Clean Architecture](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/clean-architecture.md): 20問, Mid-Level - [Logging, Monitoring & Observability](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/logging-monitoring.md): 22問, Mid-Level - [ユニットテストとxUnit](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/unit-testing-xunit.md): 20問, Mid-Level - [統合テスト](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/integration-testing.md): 18問, Mid-Level - [Docker & Containerization](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/docker-containerization.md): 16問, Mid-Level - [NuGet パッケージ管理](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/nuget-package-management.md): 16問, Mid-Level - [リアクティブプログラミング](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/reactive-programming.md): 24問, Senior - [Async/await とパターン](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/async-await-patterns.md): 26問, Senior - [.NET デザインパターン](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/dotnet-design-patterns.md): 24問, Senior - [パフォーマンス最適化](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/performance-optimization.md): 22問, Senior - [セキュリティとベストプラクティス](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/security-best-practices.md): 24問, Senior - [SignalR とリアルタイム](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/signalr-realtime.md): 22問, Senior - [マイクロサービスアーキテクチャ](https://sharpskill.dev/ja/technologies/dotnet/interview-questions/microservices-architecture.md): 25問, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/ja/technologies/dotnet/interview-questions/memory-management-gc