[MPlayer-dev-eng] [RFC] rlimits support

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sat Oct 9 17:23:28 CEST 2010


On Sat, Oct 09, 2010 at 06:07:59PM +0400, Yuriy Kaminskiy wrote:
> Reimar Döffinger wrote:
> > Hello,
> > this is an unfinished patch to add support for rlimits.
> > The main point of it would be to limit RLIMIT_DATA to something
> > "reasonable" like e.g. 512 MB by default, which for most users
> 
> Why patch mplayer (+ option, documentation, translation, configure,...), when it
> can be solved just by
> === mplayer.sh
> #!/bin/sh
> (u=`ulimit -d`; [ $u = unlimited ] || [ $u -gt 524288 ]) && ulimit -d 524288
> exec mplayer "$@"
> ===
> ?

Doesn't work on Windows.
Won't just happen by default if some user runs it randomly.

> Besides, RLIMIT_DATA limits only heap area (sbrk), and modern malloc also uses
> mmap for larger allocation, so you need RLIMIT_AS (ulimit -v) instead.

The point is not to cover every conceivable case.

> Plus in certain cases you may want use e.g. extremely big cache, or -vo gl may
> have strange ideas about mmaping videomemory, so hardcoding such things is not
> very good idea.

That's the reason why RLIMIT_AS will not work, at least as long as it won't
distinguish between anonymous and device, file or otherwise backed data.
The extremely large cache case could be handle for example.
Either way it won't be hardcoded, it will just set something by default.
There's no question there's a risk it will break in some cases though.

> Also consider ffmpeg-mt (especially at 1080p and higher), it also raises memory
> consumption a bit.

512 MB is 171 1080p frames, it surely won't behave that insanely?


More information about the MPlayer-dev-eng mailing list