AIToday
Image GenerationAI Coding AssistantsOpen-Source AIr/LocalLLaMAPublished: Mar 25, 2026, 04:33 JST1 min read

Two environment variables prevent memory leaks in Ollama, vLLM, and TGI by fixing glibc heap fragmentation issues

Two environment variables prevent memory leaks in Ollama, vLLM, and TGI by fixing glibc heap fragmentation issues

3 Key Points

  1. Model servers like Ollama, vLLM, and TGI experience memory creep caused by glibc's heap allocator fragmenting and not returning pages to the OS

  2. Setting MALLOC_MMAP_THRESHOLD_=65536 and MALLOC_TRIM_THRESHOLD_=65536 before process startup resolves the issue without code changes

  3. Testing on 13 diffusion models showed dramatic improvement: before the fix, OOM occurred at 52GB after 17 hours; after the fix, memory remained stable at ~1.2GB indefinitely

  4. Full benchmark data and testing script available on GitHub at brjen/pytorch-memory-fix repository

Ask the AI about this article →

Get the latest Image Generation news every morning

For example, today's edition would include:

  • Why AI images feel 'cringey' to consumersITmedia AI+ · 5h ago
  • Disney concept art auction fetches $3.43MTop Companies AI · 2d ago
  • ESP32-P4 Reads Water Meter with AIr/robotics · 2d ago

AI-summarized, only the topics you pick — one digest a day via Email, Slack, or Discord.

Free · takes 30 seconds · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. Q&As are published on this page for other readers too.

Related Articles

Next articleSamsung commits to fully autonomous AI-run factories by 2030, raising major questions about product liability when machines make independent decisions.