forked from enlightenment/enlightenment
e system - force a malloc trim regularly to keep back-end proc minimal
This commit is contained in:
parent
63ae3290fb
commit
5b5c7c3cb3
|
@ -154,6 +154,12 @@ if cc.has_header('sys/procctl.h') == true
|
||||||
config_h.set('HAVE_PROCCTL' , '1')
|
config_h.set('HAVE_PROCCTL' , '1')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if cc.has_header('malloc.h') == true
|
||||||
|
config_h.set('HAVE_MALLOC_H' , '1')
|
||||||
|
endif
|
||||||
|
if cc.has_function('malloc_trim') == true
|
||||||
|
config_h.set('HAVE_MALLOC_TRIM' , '1')
|
||||||
|
endif
|
||||||
if cc.has_function('setenv') == true
|
if cc.has_function('setenv') == true
|
||||||
config_h.set('HAVE_SETENV' , '1')
|
config_h.set('HAVE_SETENV' , '1')
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -66,6 +66,9 @@ void *alloca (size_t);
|
||||||
# include <inttypes.h>
|
# include <inttypes.h>
|
||||||
# include <assert.h>
|
# include <assert.h>
|
||||||
# include <fcntl.h>
|
# include <fcntl.h>
|
||||||
|
# ifdef HAVE_MALLOC_H
|
||||||
|
# include <malloc.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
#if defined (__FreeBSD__) || defined (__OpenBSD__)
|
#if defined (__FreeBSD__) || defined (__OpenBSD__)
|
||||||
# include <sys/sysctl.h>
|
# include <sys/sysctl.h>
|
||||||
|
|
|
@ -257,6 +257,17 @@ singleton_setup(void)
|
||||||
ecore_thread_feedback_run(_cb_die, NULL, NULL, NULL, NULL, EINA_TRUE);
|
ecore_thread_feedback_run(_cb_die, NULL, NULL, NULL, NULL, EINA_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
_cb_idle_enterer(void *data EINA_UNUSED)
|
||||||
|
{
|
||||||
|
// welcome to unportable code land... :)
|
||||||
|
// trim process down as much as possible when going idle
|
||||||
|
#ifdef HAVE_MALLOC_TRIM
|
||||||
|
malloc_trim(0);
|
||||||
|
#endif
|
||||||
|
return ECORE_CALLBACK_RENEW;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc EINA_UNUSED, const char **argv EINA_UNUSED)
|
main(int argc EINA_UNUSED, const char **argv EINA_UNUSED)
|
||||||
{
|
{
|
||||||
|
@ -282,6 +293,8 @@ main(int argc EINA_UNUSED, const char **argv EINA_UNUSED)
|
||||||
e_system_l2ping_init();
|
e_system_l2ping_init();
|
||||||
e_system_cpufreq_init();
|
e_system_cpufreq_init();
|
||||||
|
|
||||||
|
ecore_idle_enterer_add(_cb_idle_enterer, NULL);
|
||||||
|
|
||||||
ecore_main_loop_begin();
|
ecore_main_loop_begin();
|
||||||
|
|
||||||
e_system_cpufreq_shutdown();
|
e_system_cpufreq_shutdown();
|
||||||
|
|
Loading…
Reference in New Issue