Marc Espie writes:

> Note that gimp itself has some control over memory used
> under various circumstances in its Preferences.
>
> I haven't seen any indication that authors in this thread
> are even aware those parameters exist.

Here is a fresh diff providing conservative upper limits for
tile-cache-size and undo-size such that using basic tools won't crash
GIMP and no tweaks are required by the user. There is a MESSAGE to
optionally tweak limits if better performance is desired.

~/.config/GIMP/gimprc and /etc/gimp/2.0/gimprc are consulted for tile
cache size. Clicking "reset" in System Resources removes the options
from ~/.config/GIMP/gimprc.

Interestingly, GIMP snapshot has roughly half rss and does not crash in
this manner. I modified both stable and snapshot for consistency even
though perhaps only stable needs it.

crash repro steps:
==================
1. login.conf:
datasize-max=1024M
datasize-cur=1024M
   or
$ ulimit -d 1000000

2. Edit > Preferences > System Resources
Maximum undo memory 5G
Tile cache size 20G

3. ok and restart gimp
4. open image
5. shift+s for scale
6. use corners and rescale
7. gimp crashes

effectiveness of tile cache size:
=================================
1. restart gimp
2. edit tile cache size to 1G
3. ok and restart gimp
4. scale image and it won't crash

Index: snapshot/Makefile
===================================================================
RCS file: /cvs/ports/graphics/gimp/snapshot/Makefile,v
retrieving revision 1.3
diff -u -p -u -p -r1.3 Makefile
--- snapshot/Makefile   12 Sep 2022 14:21:07 -0000      1.3
+++ snapshot/Makefile   20 Sep 2022 23:16:08 -0000
@@ -1,6 +1,7 @@
 COMMENT=       GNU Image Manipulation Program
 V=2.99
 DISTNAME =     gimp-${V}.12
+REVISION =     0
 
 .for i in gimp gimpbase gimpcolor gimpconfig gimpmath gimpmodule \
        gimpthumb gimpui gimpwidgets gimp-scriptfu
Index: snapshot/patches/patch-etc_gimprc_in
===================================================================
RCS file: snapshot/patches/patch-etc_gimprc_in
diff -N snapshot/patches/patch-etc_gimprc_in
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ snapshot/patches/patch-etc_gimprc_in        20 Sep 2022 23:16:08 -0000
@@ -0,0 +1,23 @@
+conservative upper limit to memory used
+
+Index: etc/gimprc.in
+--- etc/gimprc.in.orig
++++ etc/gimprc.in
+@@ -47,7 +47,7 @@
+ # specified in bytes, kilobytes, megabytes or gigabytes. If no suffix is
+ # specified the size defaults to being specified in kilobytes.
+ # 
+-# (tile-cache-size 2g)
++(tile-cache-size 512m)
+ 
+ # When enabled, uses OpenCL for some operations.  Possible values are yes and
+ # no.
+@@ -266,7 +266,7 @@
+ # bytes, kilobytes, megabytes or gigabytes. If no suffix is specified the
+ # size defaults to being specified in kilobytes.
+ # 
+-# (undo-size 1g)
++(undo-size 256m)
+ 
+ # Sets the size of the previews in the Undo History.  Possible values are
+ # tiny, extra-small, small, medium, large, extra-large, huge, enormous and
Index: snapshot/pkg/MESSAGE
===================================================================
RCS file: snapshot/pkg/MESSAGE
diff -N snapshot/pkg/MESSAGE
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ snapshot/pkg/MESSAGE        20 Sep 2022 23:16:08 -0000
@@ -0,0 +1,6 @@
+By default GIMP has conservative upper limits on memory usage for `Tile
+cache size (tile-cache-size)' and `Maximum undo memory (undo-size)' set
+in ${SYSCONFDIR}/gimp/${V}/gimprc. For better performance, consider
+increasing data size limit in /etc/login.conf and increasing these upper
+limits in Edit > Preferences > System Resources. For more details, hover
+over the input value for a tooltip or see gimprc(5).
Index: stable/Makefile
===================================================================
RCS file: /cvs/ports/graphics/gimp/stable/Makefile,v
retrieving revision 1.154
diff -u -p -u -p -r1.154 Makefile
--- stable/Makefile     10 Sep 2022 12:49:22 -0000      1.154
+++ stable/Makefile     20 Sep 2022 23:16:08 -0000
@@ -1,7 +1,7 @@
 COMMENT=       GNU Image Manipulation Program
 
 DISTNAME =     gimp-2.10.32
-REVISION =     0
+REVISION =     1
 
 .for i in gimp gimpbase gimpcolor gimpconfig gimpmath gimpmodule \
        gimpthumb gimpui gimpwidgets
Index: stable/patches/patch-etc_gimprc_in
===================================================================
RCS file: stable/patches/patch-etc_gimprc_in
diff -N stable/patches/patch-etc_gimprc_in
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ stable/patches/patch-etc_gimprc_in  20 Sep 2022 23:16:08 -0000
@@ -0,0 +1,23 @@
+conservative upper limit to memory used
+
+Index: etc/gimprc.in
+--- etc/gimprc.in.orig
++++ etc/gimprc.in
+@@ -47,7 +47,7 @@
+ # specified in bytes, kilobytes, megabytes or gigabytes. If no suffix is
+ # specified the size defaults to being specified in kilobytes.
+ # 
+-# (tile-cache-size 2g)
++(tile-cache-size 512m)
+ 
+ # When enabled, uses OpenCL for some operations.  Possible values are yes and
+ # no.
+@@ -267,7 +267,7 @@
+ # bytes, kilobytes, megabytes or gigabytes. If no suffix is specified the
+ # size defaults to being specified in kilobytes.
+ # 
+-# (undo-size 1g)
++(undo-size 256m)
+ 
+ # Sets the size of the previews in the Undo History.  Possible values are
+ # tiny, extra-small, small, medium, large, extra-large, huge, enormous and
Index: stable/pkg/MESSAGE
===================================================================
RCS file: stable/pkg/MESSAGE
diff -N stable/pkg/MESSAGE
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ stable/pkg/MESSAGE  20 Sep 2022 23:16:08 -0000
@@ -0,0 +1,6 @@
+By default GIMP has conservative upper limits on memory usage for `Tile
+cache size (tile-cache-size)' and `Maximum undo memory (undo-size)' set
+in ${SYSCONFDIR}/gimp/2.0/gimprc. For better performance, consider
+increasing data size limit in /etc/login.conf and increasing these upper
+limits in Edit > Preferences > System Resources. For more details, hover
+over the input value for a tooltip or see gimprc(5).

Reply via email to