[gimp/gimp-2-8] app: default to half the physical memory for the tile-cache-size setting



commit 36bb8a625bdb561b8eb13ba12d3148416e11aa0e
Author: Michael Natterer <mitch gimp org>
Date:   Sun May 13 20:19:40 2012 +0200

    app: default to half the physical memory for the tile-cache-size setting
    
    Wanted to do this for ages but forgot...

 app/config/gimpbaseconfig.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/app/config/gimpbaseconfig.c b/app/config/gimpbaseconfig.c
index efee3c8..0fa1e60 100644
--- a/app/config/gimpbaseconfig.c
+++ b/app/config/gimpbaseconfig.c
@@ -106,6 +106,7 @@ gimp_base_config_class_init (GimpBaseConfigClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   gint          num_processors;
+  guint64       memory_size;
 
   parent_class = g_type_class_peek_parent (klass);
 
@@ -138,10 +139,18 @@ gimp_base_config_class_init (GimpBaseConfigClass *klass)
                                  "num-processors", NUM_PROCESSORS_BLURB,
                                  1, GIMP_MAX_NUM_THREADS, num_processors,
                                  GIMP_PARAM_STATIC_STRINGS);
+
+  memory_size = get_physical_memory_size ();
+
+  if (memory_size > 0)
+    memory_size = memory_size / 2; /* half the memory */
+  else
+    memory_size = 1 << 30; /* 1GB */
+
   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),
-                                    1 << 30, /* 1GB */
+                                    memory_size,
                                     GIMP_PARAM_STATIC_STRINGS |
                                     GIMP_CONFIG_PARAM_CONFIRM);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]