Fix appcore_base_flush_memory API
[platform/core/appfw/app-core.git] / src / base / appcore_base.c
index c815922..cc311a9 100644 (file)
@@ -45,6 +45,7 @@
 #define RESOURCED_FREEZER_PATH "/Org/Tizen/Resourced/Freezer"
 #define RESOURCED_FREEZER_INTERFACE "org.tizen.resourced.freezer"
 #define RESOURCED_FREEZER_SIGNAL "FreezerState"
+#define SQLITE_FLUSH_MAX (1024 * 1024)
 
 typedef struct _appcore_base_context {
        appcore_base_ops ops;
@@ -1088,6 +1089,13 @@ EXPORT_API void appcore_base_fini(void)
 
 EXPORT_API int appcore_base_flush_memory(void)
 {
+       int (*sqlite3_free_heap_memory)(int);
+
+       sqlite3_free_heap_memory = dlsym(RTLD_DEFAULT,
+                       "sqlite3_release_memory");
+       if (sqlite3_free_heap_memory)
+               sqlite3_free_heap_memory(SQLITE_FLUSH_MAX);
+
        malloc_trim(0);
        return 0;
 }
@@ -1321,6 +1329,16 @@ EXPORT_API void appcore_base_exit(void)
                __context.ops.exit(__context.data);
 }
 
+EXPORT_API void appcore_base_add_suspend_timer(void)
+{
+       __add_suspend_timer();
+}
+
+EXPORT_API void appcore_base_remove_suspend_timer(void)
+{
+       __remove_suspend_timer();
+}
+
 static int __on_receive(aul_type type, bundle *b, void *data)
 {
        return appcore_base_on_receive(type, b);