19.05.2024 18:04, Thomas Frohwein пишет:
> 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.

Fair point, so 1.5G crashed and 3G worked;  I did a big game with 2G and
it worked, so I'll pick that and we can still crank if needed.

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

I tested the pop-up with an extra *5 to make it fail.
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 19:36:15 -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
@@ -105,7 +105,7 @@ do-install:
        cp -R ${WRKDIST}/binaries/data/* ${PREFIX}/share/0ad
        ${INSTALL_DATA} ${WRKDIST}/binaries/system/lib* ${PREFIX}/lib
        ${INSTALL_PROGRAM} ${WRKDIST}/binaries/system/pyrogenesis ${PREFIX}/bin
-       ${INSTALL_SCRIPT} ${WRKDIST}/build/resources/0ad.sh ${PREFIX}/bin/0ad
+       ${SUBST_PROGRAM} ${WRKDIST}/build/resources/0ad.sh ${PREFIX}/bin/0ad
        ${INSTALL_DATA_DIR} ${PREFIX}/share/applications
        ${INSTALL_DATA} ${WRKDIST}/build/resources/0ad.desktop \
                ${PREFIX}/share/applications/
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 19:35:21 -0000
@@ -0,0 +1,21 @@
+Try to crank datasize to 2G to avoid ENOMEM crashes during big games
+
+Index: build/resources/0ad.sh
+--- build/resources/0ad.sh.orig
++++ build/resources/0ad.sh
+@@ -2,6 +2,15 @@
+ 
+ pyrogenesis=$(which pyrogenesis 2> /dev/null)
+ if [ -x "$pyrogenesis" ] ; then
++  DATASIZE=$((2 * 1024 * 1024))
++  if ! ulimit -Sd ${DATASIZE}; then
++    ${X11BASE}/bin/xmessage -file - -center -buttons yes:0,no:1 -default no 
<<- _EOF
++      Cannot increase datasize-cur to at least ${DATASIZE}
++      Do you want to run 0.A.D. anyway?
++      (If so, it may run out of memory and crash.)
++      _EOF
++    [ $? -eq 0 ] || exit
++  fi
+   "$pyrogenesis" "$@"
+ else
+   echo "Error: pyrogenesis not found in ($PATH)"

Reply via email to