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

Yuriy Kaminskiy yumkam at mail.ru
Sat Oct 9 16:07:59 CEST 2010


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 "$@"
===
?
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.

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.
Also consider ffmpeg-mt (especially at 1080p and higher), it also raises memory
consumption a bit.

> would guarantee that MPlayer never causes an unusable system
> due to a memleak and excessive swapping caused by that.
> This should also make it possible to test in a semi-automated
> way that MPlayer can handle out-of-memory conditions where
> NULL is returned by malloc. 
> It lacks at the very least: configure check, command-line option,
> documentation.



More information about the MPlayer-dev-eng mailing list