[MPlayer-users] option to save cache in temporary directory instead of memory

Reimar Döffinger Reimar.Doeffinger at gmx.de
Mon Jan 28 21:16:51 CET 2013


On Mon, Jan 28, 2013 at 06:19:22AM -0200, Sezaru wrote:
> > That would be a bug in your operating system. It has no reason to treat writing to the swap file significantly different than writing to a normal file.
> > That is, unless we are doing something stupid in the cache code MPlayer, I've not double-checked that.
> 
> Actually what is happening is just that as mplayer continues to cache
> the video (the cache is set to 2gb, so if the video is 2gb large, it
> will naturally consume 2gb of RAM), it will eat my RAM, and as
> expected, when it have used all my RAM it will start to use swap.
> 
> When I talk about the slowdown, is simply because the system will
> start to send my other programs to swap so it has enougth RAM to
> continue caching the video, as result, any of these programs will
> became really slow.
> 
> So, if there was a option to cache the video to an temporary file, it
> will not consume all my RAM.

The point is that this is not how it's supposed to work.
When caching to a file the operating system should neither more
nor less decide to swap out other programs in order to cache
this on-disk file.
Even more obviously, it should consider swapping out parts of MPlayer
like that very rarely accessed cache.
It would help to know what OS you are using, if it's e.g. Linux it might
make more sense to look into and possibly improve (or just tune) the
swapping algorithm instead of working around it behaving badly.
Like for example base the swapping decision not only on accesses but
also on fairness, i.e. try to swap out all programs equally if they all have
pages with a very low number of accesses.
Ok, that maybe is a bit overkill, if you compile from source hacking
just hacking out setting s->eof in stream/stream_file.c probably
will make it wait for data instead of exiting (but I haven't tested it,
it's probably going to have some issues).


More information about the MPlayer-users mailing list