On Sun, May 19, 2024 at 01:42:45PM +0000, Klemens Nanni wrote:
> My user is not in the 'staff' group and its default 1572864 is enough to
> start playing a serious game, which eventually crashes when, I presume,
> the world gets big enough.
> 
> Losing your game/progress like that sucks, so I just doubled the limit
> and have been playing without crashes ever since.
> 
> Is this fair enough to include in ports or should we aim for a specific
> limit?  I see the chromium ports have more logic to a) ensure a limit
> and b) present a choice when raising it fails, but none of that was
> needed for me so far, hence the simple diff.
> 
> Feedback? OK?
> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/games/0ad/base/Makefile,v
> diff -u -p -r1.51 Makefile
> --- Makefile  6 May 2024 12:23:33 -0000       1.51
> +++ Makefile  19 May 2024 10:05:32 -0000
> @@ -2,7 +2,7 @@ COMMENT =             historical real-time strategy
>  
>  DISTNAME =           0ad-${V}-alpha-unix-build
>  PKGNAME =            0ad-${V}
> -REVISION =           6
> +REVISION =           7
>  
>  USE_WXNEEDED =               Yes
>  USE_NOBTCFI =                Yes
> Index: patches/patch-build_resources_0ad_sh
> ===================================================================
> RCS file: patches/patch-build_resources_0ad_sh
> diff -N patches/patch-build_resources_0ad_sh
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-build_resources_0ad_sh      19 May 2024 11:26:28 -0000
> @@ -0,0 +1,13 @@
> +(Try to) Double datasize to avoid ENOMEM crashes during (big) games
> +
> +Index: build/resources/0ad.sh
> +--- build/resources/0ad.sh.orig
> ++++ build/resources/0ad.sh
> +@@ -2,6 +2,7 @@
> + 
> + pyrogenesis=$(which pyrogenesis 2> /dev/null)
> + if [ -x "$pyrogenesis" ] ; then
> ++  ulimit -d $((2 * `ulimit -d`))

I think the better approach is to pick an absolute datasize and set
that (or recommend it in README or MESSAGE). See chromium's
files/chrome:

DATASIZE="716800"
[...]
if [ $(ulimit -Sd) -lt ${DATASIZE} ]; then
        ulimit -Sd ${DATASIZE} || \
                xm_log "Cannot increase datasize-cur to at least ${DATASIZE}"
                [ $? -eq 0 ] || exit
fi

Otherwise you're doubling an unknown ulimit -d that might already be
sufficient.

> +   "$pyrogenesis" "$@"
> + else
> +   echo "Error: pyrogenesis not found in ($PATH)"
> 

Reply via email to