when glibc is used, call mallopt, so that memory chunks >= 4k (= 64*64

2004-04-29  Simon Budig  <simon@gimp.org>

	* app/main.c: when glibc is used, call mallopt, so that memory
	chunks >= 4k (= 64*64 pixels, 1bpp - the smallest full tile)
	get allocated via mmap. This ensures that after closing an image
	the memory allocated for image data gets returned to the system.

	Thanks to Phil Blundell <pb@nexus.co.uk> for bringing mallopt
	to my attention.

	Please watch closely for performance problems.
This commit is contained in:
Simon Budig 2004-04-29 19:47:24 +00:00 committed by Simon Budig
parent f1252babb1
commit 656795fac0
2 changed files with 23 additions and 0 deletions

View File

@ -1,3 +1,15 @@
2004-04-29 Simon Budig <simon@gimp.org>
* app/main.c: when glibc is used, call mallopt, so that memory
chunks >= 4k (= 64*64 pixels, 1bpp - the smallest full tile)
get allocated via mmap. This ensures that after closing an image
the memory allocated for image data gets returned to the system.
Thanks to Phil Blundell <pb@nexus.co.uk> for bringing mallopt
to my attention.
Please watch closely for performance problems.
2004-04-29 Michael Natterer <mitch@gimp.org>
* app/actions/Makefile.am

View File

@ -32,6 +32,10 @@
#include <unistd.h>
#endif
#ifdef __GLIBC__
#include <malloc.h>
#endif
#ifndef WAIT_ANY
#define WAIT_ANY -1
#endif
@ -240,6 +244,13 @@ main (int argc,
use_shm = TRUE;
#endif
#ifdef __GLIBC__
/* Tweak memory allocation so that memory allocated in chunks >= 4k
* (64x64 pixel 1bpp tile) gets returned to the system when free'd ().
*/
mallopt (M_MMAP_THRESHOLD, 64 * 64 - 1);
#endif
batch_cmds = g_new (gchar *, argc);
batch_cmds[0] = NULL;