plex-media-player icon indicating copy to clipboard operation
plex-media-player copied to clipboard

player: Memory usage increases over time

Open anthonybilinski opened this issue 6 years ago • 4 comments

Test environment

PMS Version: 1.13.8.5395 PMP Version: 2.21.0.dev-4839cbf2 Platform (Windows/OSX/Embedded): Ubuntu 18.04 Qt Version: 5.9.5

Steps to reproduce

  1. Run plex-media-player
  2. connect to plex server on localhost
  3. play content by connecting from app a couple hours every couple days

Current behaviour

  1. After ~1 week, memory of plexmediaplayer is at 5.5G virtual and 1.8G RES. Memory (virt) seems to keep increasing, filling up swap over time.

Have seen the same behaviour on previous plexmediaplayer versions, plexmediaserver versions, and Qt versions.

Restarting the app and continuing the video reduces system memory usage drastically. Must be done periodically.

Expected behavior

  1. Memory usage is constant over time.

anthonybilinski avatar Nov 02 '18 23:11 anthonybilinski

After 4 days without restarting the app, I noticed plexmediaplayer had lots of threads (I hadn't checked before): 23 QtWebEngineProcess threads 46 plexmediaplayer threads

The current memory usage of plexmediaplayer is now: 3741M res, 7464M virt.

anthonybilinski avatar Nov 07 '18 08:11 anthonybilinski

Restarting the app and continuing the video reduces system memory usage drastically. Must be done periodically.

mseeley avatar Nov 07 '18 18:11 mseeley

Hi @anthonybilinski thank you for the information and update.

Restarting the app and continuing the video reduces system memory usage drastically. Must be done periodically.

Restarting the app reducing memory definitely points to memory/resource mismanagement. The second part, "continuing the video", has me curious. Is a video left paused for an extended time showing increased memory usage that's cleared once video playback is resumed?

Our team will triage this issue soon. If we can reproduce on Windows or MacOS there's a better chance we'd look for a culprit; in the meantime I've tagged as a Linux support issue. If not there's a reasonable chance this issue remains in the backlog until Qt and/or MPV are upgraded.

mseeley avatar Nov 07 '18 18:11 mseeley

The second part, "continuing the video", has me curious. Is a video left paused for an extended time showing increased memory usage that's cleared once video playback is resumed?

by this I meant exiting plexmediaplayer completely, re-opening and starting the video again. I do not see a decrease in memory usage by resuming a video without restarting plexmediaplayer.

Some added memory info from a instance of it running for 9 days, playing maybe 3 movies and 10 TV episodes:

(gdb) p main_arena.system_mem
$1 = 667455488
(gdb) p main_arena.max_system_mem
$2 = 667455488
(gdb) p mp_
$3 = {trim_threshold = 13148160, top_pad = 131072, mmap_threshold = 6574080, arena_test = 8, arena_max = 0, n_mmaps = 3, 
  n_mmaps_max = 65536, max_n_mmaps = 6, no_dyn_threshold = 0, mmapped_mem = 89178112, max_mmapped_mem = 107372544, 
  sbrk_base = 0x562762d19000 "", tcache_bins = 64, tcache_max_bytes = 1032, tcache_count = 7, tcache_unsorted_limit = 0}

from /proc/*/smaps:

6377480 (6GB) of anonymous mapped files
	4.9GB of rw-p
	0.8GB of ---p
	0.4GB of rwxp

8397992 (8GB) total "Size"

so that narrows it down to basically.. something is mallocing somewhere :)

I might try some light memory debugging tool that can at least point to the guilty lib.

I might try reproing this on Windows, I will update if I do.

anthonybilinski avatar Dec 05 '18 01:12 anthonybilinski