screen defscrollback memory exhaustion

"Ricardo F. Teixeira" <[email protected]>
Newsgroups gmane.comp.gnu.screen.user
Message-ID <CAOyaChgAVVwRgVQ17TTcfmFiZJarcxnOf9K7QREnwrwYa==8+w@mail.gmail.com>
Hi guys,

Does anyone know how to set the size of the defscrollback buffer to unlimited?

Lookin' through the man page I saw no reference in setting an unlimited value:

defscrollback num
Same as the scrollback command except that the default setting for new
windows is changed. Initial setting is 100.

Clearly by setting the -k value to nothing (screen -h) will throw the
help menu. A negative integer doesn't a solve the problem either,
'cause screen will print an error message and will exit.

screen.c
[626] if (nwin_options.histheight < 0)
[627]    exit_with_usage(myname, "-h: %s: negative scrollback size?", *av);

The only option left is to assign a higher value to this parameter.
However I learned, from the hard way, that screen -h 10000000 will
just hang a system with low resources - screen consumed more than 1GB
of memory!

Lookin' on the source code for an answer, I noticed that screen
doesn't perform any boundaries check and will try to maintain
scrollback entirely in RAM.

On a bad perspective this leads to (another) problem: anyone with
access to a setuid screen binary (most GNU/Linux distributions have
this by _default_) can literally hang a production system.

So, does anyone have ideas on how to achieve this without freeze the system?

Thanks,

R.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.