Wednesday, September 21, 2022

Re: Repeated gimp crashes?

On 2022/09/20 16:54, Nam Nguyen wrote:
> 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.

ahhhhhh. defaults are based on this in app/config/gimpgeglconfig.c

133 memory_size = gimp_get_physical_memory_size ();
134
135 /* limit to the amount one process can handle */
136 memory_size = MIN (GIMP_MAX_MEM_PROCESS, memory_size);
137
138 if (memory_size > 0)
139 memory_size = memory_size / 2; /* half the memory */
140 else
141 memory_size = 1 << 30; /* 1GB */
142
143 GIMP_CONFIG_PROP_MEMSIZE (object_class, PROP_TILE_CACHE_SIZE,
144 "tile-cache-size",
145 "Tile cache size",
146 TILE_CACHE_SIZE_BLURB,
147 0, GIMP_MAX_MEM_PROCESS,
148 memory_size,
149 GIMP_PARAM_STATIC_STRINGS |
150 GIMP_CONFIG_PARAM_CONFIRM);

and app/config/gimpcoreconfig.c

597 undo_size = gimp_get_physical_memory_size ();
598
599 if (undo_size > 0)
600 undo_size = undo_size / 8; /* 1/8th of the memory */
601 else
602 undo_size = 1 << 26; /* 64GB */
603
604 GIMP_CONFIG_PROP_MEMSIZE (object_class, PROP_UNDO_SIZE,
605 "undo-size",
606 "Undo size",
607 UNDO_SIZE_BLURB,
608 0, GIMP_MAX_MEMSIZE, undo_size,
609 GIMP_PARAM_STATIC_STRINGS |
610 GIMP_CONFIG_PARAM_CONFIRM);

using this in app/core/gimp-utils.c

77 guint64
78 gimp_get_physical_memory_size (void)
79 {
80 #ifdef G_OS_UNIX
81 #if defined(HAVE_UNISTD_H) && defined(_SC_PHYS_PAGES) && defined (_SC_PAGE_SIZE)
82 return (guint64) sysconf (_SC_PHYS_PAGES) * sysconf (_SC_PAGE_SIZE);
83

No comments:

Post a Comment