INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Library Import memory usage  (Read 573 times)

barchar

  • Recent member
  • *
  • Posts: 10
Library Import memory usage
« on: June 29, 2023, 12:45:40 pm »

In both MC30 and MC31 I'm noticing after a certain point importing video files into my library starts to use an excessive amount of memory, that is never released back to the system. This is to the point that eventually MediaCenter will crash after exhausting the amount of memory my system can reserve, which ends up being about 238GB. Stopping the import stops the memory growth but does not release the memory back to the system.

Note that the amount of memory actually committed grows much more slowly than the amount reserved, and after stopping the import process I can see that MC31 has many very large mappings, most of them are only used a little bit, but some are fully committed. When I save one of these mappings to disk as an mp4 file MPV can play it and it does, indeed, contain data from my videos.

The video files in question are MPEG-TS files but are named as .mp4, not as .ts/.m2t/.m4t/etc, I'm not sure if this happens for any MPEG-TS file (which would be a bit surprising since DVD or blu-ray folders contain many such files) or if it's just MPEG-TS files that end up being imported as mp4.

I guess my first question is if anyone else has encountered this, and my second question is why MC even needs to read my video files into memory at all, is there some setting I can set where it can just import based on the metadata in the container and not actually read the file.

Here is JMCs memory map after growing to about 80GB of reserved memory and me stopping the import, sorted by size, and with the tail trimmed off to fit in the message length limit

Code: [Select]
Base Address, Type, Size, Protect, Use, Total WS, Private WS, Shareable WS, Shared WS, Locked WS
0x1f29b8ec000, Private: Commit, 3.62 GB, RW, , 83.52 MB, 83.52 MB, , ,
0x1f1835d8000, Private: Commit, 3.57 GB, RW, , 906.16 MB, 906.16 MB, , ,
0x1f832432000, Private: Commit, 3.4 GB, RW, , 408.05 MB, 408.05 MB, , ,
0x1f024aeb000, Private: Commit, 3.25 GB, RW, , 909.08 MB, 909.08 MB, , ,
0x1f953104000, Private: Commit, 2.99 GB, RW, , 85.67 MB, 85.67 MB, , ,
0x1fb34d2c000, Private: Commit, 2.82 GB, RW, , 593.2 MB, 593.2 MB, , ,
0x20031bb1000, Private: Commit, 2.24 GB, RW, , 432.5 MB, 432.5 MB, , ,
0x1f686013000, Private: Commit, 2.24 GB, RW, , 851.74 MB, 851.74 MB, , ,
0x1f61f8d9000, Private: Commit, 1.6 GB, RW, , 908.71 MB, 908.71 MB, , ,
0x1fe6ae02000, Private: Commit, 1.54 GB, RW, , 908.24 MB, 908.24 MB, , ,
0x1f52e74a000, Private: Commit, 1.54 GB, RW, , 908.27 MB, 908.27 MB, , ,
0x1faa113f000, Private: Commit, 1.2 GB, RW, , 908.32 MB, 908.32 MB, , ,
0x1ffea7ac000, Private: Commit, 1.11 GB, RW, , 233.2 MB, 233.2 MB, , ,
0x1ffa339c000, Private: Commit, 1.11 GB, RW, , 261.52 MB, 261.52 MB, , ,
0x1ff5bf83000, Private: Commit, 1.11 GB, RW, , 1.11 GB, 1.11 GB, , ,
0x1ff14b74000, Private: Commit, 1.11 GB, RW, , 1.11 GB, 1.11 GB, , ,
0x1fecd76c000, Private: Commit, 1.11 GB, RW, , 121.77 MB, 121.77 MB, , ,
0x1fe239f4000, Private: Commit, 1.11 GB, RW, , 321.61 MB, 321.61 MB, , ,
0x1fddc5ed000, Private: Commit, 1.11 GB, RW, , 677.64 MB, 677.64 MB, , ,
0x1fd951d5000, Private: Commit, 1.11 GB, RW, , 284.98 MB, 284.98 MB, , ,
0x1fd4ddc1000, Private: Commit, 1.11 GB, RW, , 712.43 MB, 712.43 MB, , ,
0x1fd069b5000, Private: Commit, 1.11 GB, RW, , 320.23 MB, 320.23 MB, , ,
0x1fcbf5ab000, Private: Commit, 1.11 GB, RW, , 134.58 MB, 134.58 MB, , ,
0x1fc7818f000, Private: Commit, 1.11 GB, RW, , 1.08 GB, 1.08 GB, , ,
0x1fc30d79000, Private: Commit, 1.11 GB, RW, , 118.15 MB, 118.15 MB, , ,
0x1fbe9966000, Private: Commit, 1.11 GB, RW, , 1.11 GB, 1.11 GB, , ,
0x1faed905000, Private: Commit, 1.11 GB, RW, , 691.42 MB, 691.42 MB, , ,
0x1fa59d28000, Private: Commit, 1.11 GB, RW, , 1.05 GB, 1.05 GB, , ,
0x1fa12915000, Private: Commit, 1.11 GB, RW, , 642.67 MB, 642.67 MB, , ,
0x1f90bcea000, Private: Commit, 1.11 GB, RW, , 79.02 MB, 79.02 MB, , ,
0x1f7eb020000, Private: Commit, 1.11 GB, RW, , 299.92 MB, 299.92 MB, , ,
0x1f7a3c1a000, Private: Commit, 1.11 GB, RW, , 719.71 MB, 719.71 MB, , ,
0x1f75c802000, Private: Commit, 1.11 GB, RW, , 808.49 MB, 808.49 MB, , ,
0x1f7153ee000, Private: Commit, 1.11 GB, RW, , 1.08 GB, 1.08 GB, , ,
0x1f5d84c4000, Private: Commit, 1.11 GB, RW, , 677.67 MB, 677.67 MB, , ,
0x1f5910b9000, Private: Commit, 1.11 GB, RW, , 720.21 MB, 720.21 MB, , ,
0x1f4e7339000, Private: Commit, 1.11 GB, RW, , 261.53 MB, 261.53 MB, , ,
0x1f49ff2b000, Private: Commit, 1.11 GB, RW, , 756.33 MB, 756.33 MB, , ,
0x1f458b10000, Private: Commit, 1.11 GB, RW, , 842.19 MB, 842.19 MB, , ,
0x1f411704000, Private: Commit, 1.11 GB, RW, , 712.42 MB, 712.42 MB, , ,
0x1f3ca2f5000, Private: Commit, 1.11 GB, RW, , 284.98 MB, 284.98 MB, , ,
0x1f382ee1000, Private: Commit, 1.11 GB, RW, , 320.25 MB, 320.25 MB, , ,
0x1f13c1c4000, Private: Commit, 1.11 GB, RW, , 757.98 MB, 757.98 MB, , ,
0x1f0f4dbd000, Private: Commit, 1.11 GB, RW, , 691.39 MB, 691.39 MB, , ,
0x1efdd6d7000, Private: Commit, 1.11 GB, RW, , 1.05 GB, 1.05 GB, , ,
0x1ef962cc000, Private: Commit, 1.11 GB, RW, , 720.2 MB, 720.2 MB, , ,
0x1ef82c26000, Private: Commit, 29.82 MB, RW, , 29.82 MB, 29.82 MB, , ,
0x7ff67a5e1000, Image: Commit, 19.75 MB, RX, C:\Program Files\J River\Media Center 31\Media Center 31.exe, 2.75 MB, , 19.75 MB, 2.75 MB,
0x1ef913f0000, Mapped: Commit, 17.75 MB, R, C:\Windows\Fonts\StaticCache.dat, 412 kB, , 17.75 MB, 412 kB,
0x1ef8ef59000, Private: Commit, 10.53 MB, RW, , 1.34 MB, 1.34 MB, , ,
0x1ef8b27c000, Private: Commit, 10.52 MB, RW, Process Heap Segment (ID 1), 10.48 MB, 10.48 MB, , ,
0x1ef8a22a000, Private: Commit, 8 MB, RW, , 8 MB, 8 MB, , ,
0x1ef86770000, Private: Commit, 6.97 MB, RW, , 6.97 MB, 6.97 MB, , ,
0x7ffe63ec1000, Image: Commit, 6.59 MB, RX, C:\Windows\System32\windows.storage.dll, 392 kB, , 6.59 MB, 392 kB,
0x7ffe68cd1000, Image: Commit, 6.23 MB, RX, C:\Windows\System32\shell32.dll, 48 kB, , 6.23 MB, 48 kB,
0x7ff67b9a1000, Image: Commit, 5.62 MB, R, C:\Program Files\J River\Media Center 31\Media Center 31.exe, 844 kB, 4 kB, 5.62 MB, 840 kB,
0x7ffde8f91000, Image: Commit, 5.07 MB, RX, C:\Program Files\J River\Media Center 31\JRPlayer.dll, 752 kB, , 5.07 MB, 752 kB,
0x1ef8ae00000, Private: Commit, 4.19 MB, RW, Process Heap Segment (ID 1), 4.19 MB, 4.19 MB, , ,
0x1ef8db52000, Private: Commit, 4.18 MB, RW, Process Heap Segment (ID 1), 4.18 MB, 4.18 MB, , ,
0x1ef84a0a000, Private: Commit, 4 MB, RW, , 4 MB, 4 MB, , ,
0x1ef90fa4000, Private: Commit, 3.82 MB, RW, Process Heap Segment (ID 1), 3.82 MB, 3.82 MB, , ,
0x7ffddd9c1000, Image: Commit, 3.79 MB, RX, C:\Program Files\J River\Media Center 31\JRImage.dll, 476 kB, , 3.79 MB, 476 kB,
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72438
  • Where did I put my teeth?
Re: Library Import memory usage
« Reply #1 on: June 29, 2023, 04:49:53 pm »

Hendrik took a quick look at this.  Here's what he said:

"its likely because he renamed the files to different extension"
Logged

Hendrik

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 10931
Re: Library Import memory usage
« Reply #2 on: June 30, 2023, 06:50:00 am »

As Jim hinted, it's caused by trying to parse any random media file as a MP4. MP4 has some quirks that cause it to try to read the entire file and find media information, but then of course failing to, as its not a MP4 file.

I fixed the memory leak resulting from this, so at least it'll return the memory to you after its done. I'll also look into a more narrow check to try to detect if its actually a MP4 file before it tries to do all this, but that might take a bit longer.
Logged
~ nevcairiel
~ Author of LAV Filters

barchar

  • Recent member
  • *
  • Posts: 10
Re: Library Import memory usage
« Reply #3 on: July 01, 2023, 05:46:21 pm »

I've just tried out the new version and this appears to be fixed quite effectively! It's also removed a lot of UI stutter that I was experiencing during import (stutter in all apps on my computer, not just MC). Thanks for the very quick fix!
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72438
  • Where did I put my teeth?
Re: Library Import memory usage
« Reply #4 on: July 01, 2023, 06:48:44 pm »

Your detailed description helped a lot.  Thanks!  And thanks to Hendrik for the fix!

Logged
Pages: [1]   Go Up