Memory leak in MPC HC codec? (1 Viewer)

damaster

Portal Pro
November 23, 2007
412
35
Home Country
Canada Canada
I'm running MP 1.0 SVN 21688, with StreamedMP-0.5.361. I have about 102 movies in MovingPictures and browsing through all the movies and thus loading all the backdrops and playing and stopping several movies causes MP's memory footprint to grow excessively.

Here's a snapshot of private bytes growth from since starting MP until it reaches about 1.4GB. After this, videos don't even play and I have to restart MP.

I know this might likely not be an issue of MovingPictures, and probably it's a combination of using StreamedMP with all it's backdrops and MovingPictures with all its backdrops, and TvSeries, etc., but I'm hoping one of the devs of MovingPictures has some insight on how we can better manage MP's memory usage and do better garbage collection.

34942d1234325513-movie-music-fanart-croppercapture-2-.png
 

fforde

Community Plugin Dev
June 7, 2007
2,667
1,702
42
Texas
Home Country
United States of America United States of America
Hrmm... well the backdrop loading logic is all brand new with Moving Pictures 0.7, but the logic has been complete for something like 6 weeks so it has gotten a lot of testing. When I wrote this logic I also designed very carefully to free memory used by artwork that was no longer in use. You can take a look at the code yourself, but basically when a backdrop is no longer displayed, it waits five seconds, and if it is not needed again within that time frame it is unloaded. I have done quite a bit of testing of this logic to ensure that memory is freed when necessary(and just did an additional test to make sure nothing had recently broken).

So based on all that I think your memory issue might be something outside of Moving Pictures. Can you identify what you are doing in MediaPortal when the memory starts rising though? Or is it just continuous when you have the application open?
 

damaster

Portal Pro
November 23, 2007
412
35
Home Country
Canada Canada
Hrmm... well the backdrop loading logic is all brand new with Moving Pictures 0.7, but the logic has been complete for something like 6 weeks so it has gotten a lot of testing. When I wrote this logic I also designed very carefully to free memory used by artwork that was no longer in use. You can take a look at the code yourself, but basically when a backdrop is no longer displayed, it waits five seconds, and if it is not needed again within that time frame it is unloaded. I have done quite a bit of testing of this logic to ensure that memory is freed when necessary(and just did an additional test to make sure nothing had recently broken).

So based on all that I think your memory issue might be something outside of Moving Pictures. Can you identify what you are doing in MediaPortal when the memory starts rising though? Or is it just continuous when you have the application open?

Yup, like I said, I don't think the issue is with MovingPictures and I'm sure you're cleaning up memory as you should. Memory growth really happens for me when I play a video, then stop, then play another, then stop, etc. After playing and stopping about 6-10 720p/1080p MKVs, the memory growth occurs. What I notice is that when I start a video, memory goes up, and when I stop it memory is freed but not all the memory, and thus the leak. Eventually the leak gets rather larger and MP's private byte usage goes up significantly.

I posted here because as is shown with your excellent response time, I expected to get the best response and insight into my problem in this sub-forum. I've posted this issue elsewhere on the forum with little to no response from devs.

Anyhow, I'm investigating the code further and may try to run some profiling to see what's going on. Hopefully I can fix this on my own.

Thanks for your help.
 

fforde

Community Plugin Dev
June 7, 2007
2,667
1,702
42
Texas
Home Country
United States of America United States of America
I have heard that the fan-art implementation in MyVideos and MyMusic(?) does nto proeprly free backdrops, if you use those features you may want to start there. You may also want to look into the control that rotates images, I forget the name... Used on the Aeon and StreamedMP basichome screens. Anything that has a high turn-over rate of artwork...
 

damaster

Portal Pro
November 23, 2007
412
35
Home Country
Canada Canada
Leak is in MPCVideoDec DirectShow filter!

I found the source of the memory leak, and it was in the one place I least expected it: in the MPCVideoDec DirectShow filter! I switched to the PowerDVD 8 H.264/AVC/VC1 decoder and played and stopped several 1080p H.264 videos. With the PowerDVD 8 decoder, memory is freed up as it should be and there is no apparent leak. With MPCVideoDec, there is a very clear memory leak.

Here are my results. The graph on the left is with the PowerDVD 8 decoder and the graph on the right is with the MPCVideoDec decoder.

I better update my MP install guide and tell folks to avoid using the MPCVideoDec decoder.

attachment.php
 

Attachments

  • CropperCapture[3].Png
    CropperCapture[3].Png
    39.6 KB

tourettes

Retired Team Member
  • Premium Supporter
  • January 7, 2005
    17,301
    4,800
    Even if it's codec specific it could be MediaPortal that is leaking. There could be some issue on the graph cleaning/release code. Can you reproduce similar leak in other directshow applications with the same codec?
     

    damaster

    Portal Pro
    November 23, 2007
    412
    35
    Home Country
    Canada Canada
    Even if it's codec specific it could be MediaPortal that is leaking. There could be some issue on the graph cleaning/release code. Can you reproduce similar leak in other directshow applications with the same codec?

    Good point. I haven't tried actually, and it is getting late on my side of the world so it's time for some zzzz's. If someone else watching this thread has the time to run this test that would be great.
     

    Users who are viewing this thread

    Top Bottom