forked from enlightenment/enlightenment
mem trimming - have e trim its own memory every now and again
use malloc_trim() if it exists to do this every now and again (idle_enterer if there isa gap > 10 sec since last clean cycle so no added wakeups).
This commit is contained in:
parent
5b5c7c3cb3
commit
af0d44a57d
|
@ -104,6 +104,10 @@ void *alloca (size_t);
|
|||
# include <execinfo.h>
|
||||
# endif
|
||||
|
||||
# ifdef HAVE_MALLOC_H
|
||||
# include <malloc.h>
|
||||
# endif
|
||||
|
||||
// XXX: FIXME: TMP solution for window stack until api is settled
|
||||
#define EFL_BETA_API_SUPPORT
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue