All pastes #733239 Raw Edit

Someone

public text v1 · immutable
·published 2007-10-11 17:20 UTC
rendered paste body
By caching pixmaps to X11, it is possible that Xorg might crash the
system or render it unusable. This occured in an LTSP context and the
workaround was to add the following lines to the script calling startx.
This essentially sets a ulimit on Xorg to about 80% of the memory:

X_RAMPERC=${X_RAMPERC:-100}

if [ ${X_RAMPERC} -lt 100 ]; then
    XMEM=0
    while read TYPE VALUE UNITS; do
        case ${TYPE} in
            MemFree:|SwapFree:)
                XMEM=$((${XMEM} + ${VALUE}))
                ;;
        esac
    done < /proc/meminfo
    XMEM=$((${XMEM} * ${X_RAMPERC} / 100))

    ulimit -m ${XMEM}
fi

Please note this is only a workaround and might not be appropriate in
every context. However, I thought it might be useful to share this
knowledge.