+static guint __flush_timer = 0;
+
+static gboolean __flush_memory(gpointer data)
+{
+ _DBG("Flush memory");
+ if (_appcore_mw_context.ops.base.trim_memory)
+ _appcore_mw_context.ops.base.trim_memory(_appcore_mw_context.data);
+ __flush_timer = 0;
+ return G_SOURCE_REMOVE;
+}
+
+static void __add_flush_timer(void)
+{
+ if (__flush_timer)
+ return;
+
+ __flush_timer = g_timeout_add(5000, __flush_memory, NULL);
+}
+
+static void __remove_flush_timer(void)
+{
+ if (!__flush_timer)
+ return;
+
+ g_source_remove(__flush_timer);
+ __flush_timer = 0;
+}