app: default to half the physical memory for the tile-cache-size setting

Wanted to do this for ages but forgot...
(cherry picked from commit 36bb8a625b)

Additionally, set the default undo memory size to 1/8th of the
physical memory.
This commit is contained in:
Michael Natterer
2012-05-13 20:19:40 +02:00
parent b73bc11d3f
commit 14b51cc558
2 changed files with 21 additions and 2 deletions

View File

@ -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 = gimp_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);

View File

@ -31,6 +31,7 @@
#include "config-types.h"
#include "core/core-types.h"
#include "core/gimp-utils.h"
#include "core/gimpgrid.h"
#include "core/gimptemplate.h"
@ -141,6 +142,7 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
gchar *path;
GimpRGB red = { 1.0, 0, 0, 0.5 };
guint64 undo_size;
object_class->finalize = gimp_core_config_finalize;
object_class->set_property = gimp_core_config_set_property;
@ -376,9 +378,17 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
0, 1 << 20, 5,
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_CONFIRM);
undo_size = gimp_get_physical_memory_size ();
if (undo_size > 0)
undo_size = undo_size / 8; /* 1/8th of the memory */
else
undo_size = 1 << 26; /* 64GB */
GIMP_CONFIG_INSTALL_PROP_MEMSIZE (object_class, PROP_UNDO_SIZE,
"undo-size", UNDO_SIZE_BLURB,
0, GIMP_MAX_MEMSIZE, 1 << 26, /* 64MB */
0, GIMP_MAX_MEMSIZE, undo_size,
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_CONFIRM);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_UNDO_PREVIEW_SIZE,