vllm - 💡(How to fix) Fix [Bug]: OOM when --kv-offloading-size>1024 [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vllm-project/vllm#36623Fetched 2026-04-08 00:35:55
View on GitHub
Comments
2
Participants
2
Timeline
6
Reactions
0
Author
Timeline (top)
commented ×2closed ×1labeled ×1mentioned ×1
RAW_BUFFERClick to expand / collapse

Your current environment

  • vLLM: 0.15.0

  • TP: 8

  • Memory Limit of Pod: 1872 GB

  • GPU: 8 x H200

🐛 Describe the bug

We are testing the KV Offloading to CPU using vLLM native backend, we found that when  kv_offloading_size > 1024GB (here 1025 is used), it will result in memory leak and causing OOM finally.

From the memory profile, the memory keeps growing until OOM.

vllm.log

memory_profile_tp8-oom.csv

Before submitting a new issue...

  • Make sure you already searched for relevant issues, and asked the chatbot living at the bottom right corner of the documentation page, which can answer lots of frequently asked questions.

extent analysis

Fix Plan

To address the memory leak issue when kv_offloading_size exceeds 1024GB, we will implement a dynamic memory allocation mechanism and optimize the KV offloading process.

Step-by-Step Solution

  • Modify the kv_offloading_size check: Introduce a check to ensure kv_offloading_size does not exceed the available memory.
  • Implement dynamic memory allocation: Allocate memory dynamically based on the available resources.
  • Optimize KV offloading: Optimize the KV offloading process to reduce memory usage.

Example Code

import psutil

# Get available memory
available_memory = psutil.virtual_memory().available

# Check if kv_offloading_size exceeds available memory
if kv_offloading_size > available_memory:
    # Handle error or adjust kv_offloading_size
    print("Error: kv_offloading_size exceeds available memory")
    # Adjust kv_offloading_size to available memory
    kv_offloading_size = available_memory

# Dynamic memory allocation
allocated_memory = {}
def allocate_memory(size):
    if size > available_memory:
        # Handle error
        print("Error: Insufficient memory")
    else:
        allocated_memory['kv_offloading'] = size
        available_memory -= size

# Optimize KV offloading
def optimize_kv_offloading():
    # Implement optimization logic here
    pass

# Usage
kv_offloading_size = 1025 * (1024 ** 3)  # 1025 GB
allocate_memory(kv_offloading_size)
optimize_kv_offloading()

Verification

To verify the fix, monitor the memory usage while running the application with kv_offloading_size greater than 1024GB. The memory usage should no longer increase indefinitely, and the application should not encounter an OOM error.

Extra Tips

  • Regularly monitor memory usage to detect potential memory leaks.
  • Consider implementing a memory profiling tool to identify memory-intensive components.
  • Optimize the application's memory allocation and deallocation logic to prevent memory fragmentation.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

vllm - 💡(How to fix) Fix [Bug]: OOM when --kv-offloading-size>1024 [2 comments, 2 participants]