Mpv: Cache in mpv 0.28.2 is unreasonably huge by default, consumes gigabyte of ram

Created on 23 May 2018  路  6Comments  路  Source: mpv-player/mpv

Most noticeable on long youtube streams. With default settings mpv memory usage bloats to gigabyte+ very fast. Funniest thing is, my internet is fast enough, mpv works fine with disabled cache. No need to waste so much ram. Same happens on linux and windows.

mpv version and platform

mpv 0.28.2, archlinux x86-64, windows x64

Reproduction steps

mpv https://youtu.be/P21oZTbctZo

Expected behavior

~ ps -C mpv -o comm,rss
COMMAND RSS
mpv 151964

Actual behavior

~ ps -C mpv -o comm,rss
COMMAND RSS
mpv 1063172

Log file

https://0x0.st/s2zL.xz

Most helpful comment

Memory consumed without need, profit and reason is wasted memory, stolen from other apps and system.

All 6 comments

No need to waste so much ram

Unused memory is wasted memory. But as far as your question goes, of course it's not (shouldn't be) unlimited. Unfortunately you ignored the template and it's impossible for me to reproduce your problem.

Memory consumed without need, profit and reason is wasted memory, stolen from other apps and system.

Memory consumed without need, profit and reason is wasted memory, stolen from other apps and system.

I agree.

From your log, what I noticed is that there are like 40,000 lines of matroska demuxing output. That seems highly suspect, and would be the first thing I'd investigate in order to figure out where these gigabytes of RAM went. @wm4 probably knows more about this.

That seems to be roughly 1 GB of cache. With the default settings and 2 streams that's an expected value. The default size was reduced in mpv git. the excessive Matroska logging is @haasn's fault, but was fixed in git master.

mpv works fine with disabled cache.

Then disable it, how much of an idiot are you?

I disabled cache when this behavior was introduced. That, however does not help other users. They pass something like --cache=1000, but that does not work.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

laichiaheng picture laichiaheng  路  3Comments

yuvadm picture yuvadm  路  3Comments

WoLpH picture WoLpH  路  3Comments

ghost picture ghost  路  3Comments

lightonflux picture lightonflux  路  4Comments