mpv-player / mpv-player/mpv

Memory leak when pressing <><><> many times or playing a long playlist.

Open
#16,658 21 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

os:linux
Dominant language
C
Stars
37k
Forks
3.5k
Avg merge
1d 10h
Merged PRs (30d)
22

Description

mpv Information
mpv v0.40.0 Copyright © 2000-2025 mpv/MPlayer/mplayer2 projects
libplacebo version: v7.349.0
FFmpeg version: 7.1.1-1+b1
FFmpeg library versions:
   libavcodec      61.19.101
   libavdevice     61.3.100
   libavfilter     10.4.100
   libavformat     61.7.100
   libavutil       59.39.100
   libswresample   5.3.100
   libswscale      8.3.100
Other Information
- Linux version: Debian 13.0
- Kernel Version: 6.12.38+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.38-1 (2025-07-16) x86_64 GNU/Linux
- GPU Model: NVIDIA Corporation GA106M [GeForce RTX 3060 Mobile / Max-Q] (using nouveau)
- Mesa/GPU Driver Version: 4.6 (Compatibility Profile) Mesa 25.0.7-2
- Window Manager and Version: Gnome 48.0
- Source of mpv: Debian 13.0
- Latest known working version: Debian 12.11 version, 0.35.1-4
- Issue started after the following happened: Upgraded to Debian 13.0
Reproduction Steps

Run mpv with at two video files in playlist. Run top in a different window to observe memory usage. Once mpv starts, type "><><><><><><><><><><" over and over into mpv video window for a few minutes. Observe memory usage climb until OOM killer kills mpv.

I use:
mpv --no-config --vo=gpu --gpu-debug --log-file=output.txt file1 file2

Problem only occurs with certain video files. Though many files, not just these two, trigger memory leak. But some files do not. I have not been able to determine pattern.

Problem occurs with --hwdec=auto, --hwdec=no. Problem occurs with --vo=gpu-next, --vo=dmabuf-wayland, --vo=gpu.

Problem also occurs when I play a 9000 video playlist and just let it run for hours without typing anything.

ffprobe for file1 and file2:

Input #0, matroska,webm, from 'file1':
Metadata:
encoder : libebml v1.3.4 + libmatroska v1.4.5
creation_time : 2018-09-21T21:22:28.000000Z
Duration: 00:03:54.29, start: 0.000000, bitrate: 1992 kb/s
Stream #0:0(eng): Audio: aac (LC), 44100 Hz, stereo, fltp (default)
Metadata:
BPS : 125588
BPS-eng : 125588
DURATION : 00:03:54.289000000
DURATION-eng : 00:03:54.289000000
NUMBER_OF_FRAMES: 10090
NUMBER_OF_FRAMES-eng: 10090
NUMBER_OF_BYTES : 3677999
NUMBER_OF_BYTES-eng: 3677999
_STATISTICS_WRITING_APP: mkvmerge v9.8.0 ('Kuglblids') 64bit
_STATISTICS_WRITING_APP-eng: mkvmerge v9.8.0 ('Kuglblids') 64bit
_STATISTICS_WRITING_DATE_UTC: 2018-09-21 21:22:28
_STATISTICS_WRITING_DATE_UTC-eng: 2018-09-21 21:22:28
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:1: Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 1k tbn (default)
Metadata:
BPS : 1865345
BPS-eng : 1865345
DURATION : 00:03:54.200000000
DURATION-eng : 00:03:54.200000000
NUMBER_OF_FRAMES: 7019
NUMBER_OF_FRAMES-eng: 7019
NUMBER_OF_BYTES : 54607984
NUMBER_OF_BYTES-eng: 54607984
_STATISTICS_WRITING_APP: mkvmerge v9.8.0 ('Kuglblids') 64bit
_STATISTICS_WRITING_APP-eng: mkvmerge v9.8.0 ('Kuglblids') 64bit
_STATISTICS_WRITING_DATE_UTC: 2018-09-21 21:22:28
_STATISTICS_WRITING_DATE_UTC-eng: 2018-09-21 21:22:28
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
_STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file2':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.25.100
Duration: 00:04:34.10, start: 0.000000, bitrate: 5155 kb/s
Stream #0:00x1: Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 5016 kb/s, 30 fps, 30 tbr, 16k tbn (default)
Metadata:
handler_name : VideoHandler
vendor_id : [0][0][0][0]
Stream #0:10x2: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
vendor_id : [0][0][0][0]

Expected Behavior

Play videos without triggering OOM killer.

Actual Behavior

Memory usage increases until triggers OOM killer.

Log File

output.txt

Sample Files

No response

I carefully read all instruction and confirm that I did the following:
  • I tested with the latest mpv version to validate that the issue is not already fixed.
  • I provided all required information including system and mpv version.
  • I produced the log file with the exact same set of files, parameters, and conditions used in "Reproduction Steps", with the addition of --log-file=output.txt.
  • I produced the log file while the behaviors described in "Actual Behavior" were actively observed.
  • I attached the full, untruncated log file.
  • I attached the backtrace in the case of a crash.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the leak with the stated mpv command, the two playlist files, repeated ">" and "<" input, and the attached output.txt log. Compare memory usage across the listed video-output and hardware-decoding options; done means playlist playback and repeated navigation no longer cause unbounded growth or an OOM kill.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, linux
Domain
desktop, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.