dotnet memory_error ai_generated true

OutOfMemoryException with available memory remaining

ID: dotnet/memory-fragmentation

Also available as: JSON · Markdown
75%Fix Rate
80%Confidence
3Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
8 active

Root Cause

Large Object Heap fragmentation causing OOM despite free memory.

generic

Workarounds

  1. 90% success Use ArrayPool<T> and MemoryPool<T> to reduce LOH allocations
  2. 85% success Enable GCSettings.LargeObjectHeapCompactionMode for periodic compaction

Dead Ends

Common approaches that don't work:

  1. Force GC.Collect() frequently 78% fail

    Degrades performance, doesnt fix fragmentation

  2. Increase process memory limit 72% fail

    Fragmentation still occurs