From d0be6945e803f3998eda7d4baed3985f35450574 Mon Sep 17 00:00:00 2001 From: Dmitry Rozenshtein Date: Wed, 31 Aug 2011 13:32:24 +0300 Subject: [PATCH] Fixes: NB#277092 - With Applauncher Gallery process does not release ~10 MB dirty memory when in background RevBy: Pertti Kellomaki --- debian/changelog | 2 +- src/launcher/launcher.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index 796f936..5c03ff2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,6 @@ applauncherd (1.0.9) unstable; urgency=low - * + * Fixes: NB#277092 - With Applauncher Gallery process does not release ~10 MB dirty memory when in background -- Nimika Keshri Wed, 31 Aug 2011 13:30:06 +0300 diff --git a/src/launcher/launcher.c b/src/launcher/launcher.c index 67585df..8748c27 100644 --- a/src/launcher/launcher.c +++ b/src/launcher/launcher.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "preload.h" @@ -153,6 +154,21 @@ int main(int argc, char ** argv) // a RAM disk. setenv("TMPDIR", "/var/tmp", 0); + // Since this application is classified as suid application due to it's credentials + // the environment variables below are not processed by eglibc + // so we're processing this to set correct memory options + char* s = NULL; + if((s = getenv("MALLOC_TRIM_THRESHOLD_"))) + mallopt(M_TRIM_THRESHOLD, atoi(s)); + if((s = getenv("MALLOC_TOP_PAD_"))) + mallopt(M_TOP_PAD, atoi(s)); + if((s = getenv("MALLOC_PERTURB_"))) + mallopt(M_PERTURB, atoi(s)); + if((s = getenv("MALLOC_MMAP_THRESHOLD_"))) + mallopt(M_MMAP_THRESHOLD, atoi(s)); + if((s = getenv("MALLOC_MMAP_MAX_"))) + mallopt(M_MMAP_MAX, atoi(s)); + // Preload libraries if (!helpWanted) loadLibraries(gLibs, sizeof(gLibs) / sizeof(char *));