Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crazy memory leaks #4735

Closed
xnoreq opened this issue Aug 8, 2017 · 8 comments

Comments

Projects
None yet
3 participants
@xnoreq
Copy link
Contributor

commented Aug 8, 2017

mpv version and platform

mpv 0.26.0

Reproduction steps

hwdec=d3d11va-copy
opengl-backend=angle
hwdec-codecs=all

Add a bunch of videos to mpv. Mash the key bound to playlist-next.

Expected behavior

Bounded memory usage. Playing a ~5000 kbps bitrate full hd video I measure about 80 MB private working set.
I don't see a reason why memory usage should increase beyond that, especially when switching to lower bitrate videos.
grafik

Actual behavior

Memory usage grows until the system runs out of memory and mpv crashes or is killed.

After roughly 30 times playlist-next:
grafik

More detailed process stats also showing leaking handles:
Before:
grafik

After roughly 30 skips:
grafik

@xnoreq

This comment has been minimized.

Copy link
Contributor Author

commented Aug 8, 2017

Further details:
A detailed look at the handles shows:

  • what seems to be graphics driver DirectX cache File & Section & Event handles leaking,
  • lots of threads leaking
  • the rest are countless unnamed Event & Mutant (mutex, semaphore) type handles leaking
@wm4

This comment has been minimized.

Copy link
Contributor

commented Aug 8, 2017

Can't reproduce. Missing log file.

@haasn

This comment has been minimized.

Copy link
Member

commented Aug 8, 2017

Does setting hwdec=no fix it?

@xnoreq

This comment has been minimized.

Copy link
Contributor Author

commented Aug 8, 2017

@haasn I'm not seeing these leaks with hwdec=no or hwdec-codecs=none.

@haasn

This comment has been minimized.

Copy link
Member

commented Aug 8, 2017

Sounds like the solution is to stop using hwdec.

@xnoreq

This comment has been minimized.

Copy link
Contributor Author

commented Aug 8, 2017

Or switch to another player that uses the same libav/ffmpeg hardware acceleration but doesn't leak at all.
Thanks and good luck.

@xnoreq xnoreq closed this Aug 8, 2017

@wm4

This comment has been minimized.

Copy link
Contributor

commented Aug 8, 2017

Or you could just ignore the troll and post a log file.

wm4 pushed a commit that referenced this issue Aug 9, 2017

wm4
vd_lavc: fix device leak with copy-mode hwaccels
Apparently this was broken by the "ctx->hwdec" check in the if condition
guarding the destroy call, and "ctx->hwdec = NULL;" was moved up
earlier, making this always dead code.

This should probably be refcounted or so, although that could make it
worse as well. For now, add a flag whether the device should be
destroyed.

Fixes #4735.
@wm4

This comment has been minimized.

Copy link
Contributor

commented Aug 9, 2017

Found it - the trick was that you really need multiple files to make it show up, and that the new d3d hwaccel code must be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.