Blob Blame History Raw
From 19bee3766ab5c39fdcde4e8be26795981b7bbe76 Mon Sep 17 00:00:00 2001
From: Nils Philippsen <nils@redhat.com>
Date: Tue, 13 Nov 2012 16:21:48 +0100
Subject: [PATCH] patch: max-memsize

Squashed commit of the following:

commit 26e5611acbb0d2f23a6cf481883c4241289436bf
Author: Nils Philippsen <nils@redhat.com>
Date:   Tue Nov 13 16:12:56 2012 +0100

    app: limit physical memory size by GIMP_MAX_MEMSIZE as well
    (cherry picked from commit c4365d4c14d1a1fc35210b373119a0870458c46b)

    Conflicts:
    	app/config/gimpbaseconfig.c

commit 71f298245ee8af6fc97496eb7c83d64001b0f3db
Author: Michael Natterer <mitch@gimp.org>
Date:   Sat Oct 13 22:44:15 2012 +0200

    app: limit the pyhsical memory size by G_MAXSIZE

    because one process can't handle more.
    (cherry picked from commit 2b714fcb1a6c24bcaeb13b1c592a365c374f96d8)
---
 app/config/gimpbaseconfig.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/app/config/gimpbaseconfig.c b/app/config/gimpbaseconfig.c
index 0fa1e60..73a925d 100644
--- a/app/config/gimpbaseconfig.c
+++ b/app/config/gimpbaseconfig.c
@@ -43,6 +43,8 @@
 #include "gimp-intl.h"
 
 
+#define GIMP_MAX_MEM_PROCESS (MIN (G_MAXSIZE, GIMP_MAX_MEMSIZE))
+
 enum
 {
   PROP_0,
@@ -142,6 +144,9 @@ gimp_base_config_class_init (GimpBaseConfigClass *klass)
 
   memory_size = get_physical_memory_size ();
 
+  /* limit to the amount one process can handle */
+  memory_size = MIN (GIMP_MAX_MEM_PROCESS, memory_size);
+
   if (memory_size > 0)
     memory_size = memory_size / 2; /* half the memory */
   else
@@ -149,7 +154,7 @@ gimp_base_config_class_init (GimpBaseConfigClass *klass)
 
   GIMP_CONFIG_INSTALL_PROP_MEMSIZE (object_class, PROP_TILE_CACHE_SIZE,
                                     "tile-cache-size", TILE_CACHE_SIZE_BLURB,
-                                    0, MIN (G_MAXSIZE, GIMP_MAX_MEMSIZE),
+                                    0, GIMP_MAX_MEM_PROCESS,
                                     memory_size,
                                     GIMP_PARAM_STATIC_STRINGS |
                                     GIMP_CONFIG_PARAM_CONFIRM);
-- 
1.7.11.7