diff --git a/src/bin/e.h b/src/bin/e.h index abe5ed731..2cddb31a5 100644 --- a/src/bin/e.h +++ b/src/bin/e.h @@ -104,6 +104,10 @@ void *alloca (size_t); # include # endif +# ifdef HAVE_MALLOC_H +# include +# endif + // XXX: FIXME: TMP solution for window stack until api is settled #define EFL_BETA_API_SUPPORT diff --git a/src/bin/e_main.c b/src/bin/e_main.c index 73489167b..9ef3141cf 100644 --- a/src/bin/e_main.c +++ b/src/bin/e_main.c @@ -1752,10 +1752,23 @@ _e_main_cb_idle_after(void *data EINA_UNUSED) edje_freeze(); if (first_idle) - TS("SLEEP"); - first_idle = 0; + { + TS("SLEEP"); + first_idle = 0; + } e_precache_end = EINA_TRUE; +// every now and again trim malloc memory to stay lean-ish +#ifdef HAVE_MALLOC_TRIM + static double t_last_clean = 0.0; + double t = ecore_time_get(); + if ((t - t_last_clean) > 10.0) + { + t_last_clean = t; + malloc_trim(0); + } +#endif + return ECORE_CALLBACK_RENEW; }