Close loaded module after some requests 54/92654/1 accepted/tizen/common/20161018.175116 accepted/tizen/ivi/20161018.091639 accepted/tizen/mobile/20161018.091552 accepted/tizen/tv/20161018.091611 accepted/tizen/wearable/20161018.091622 submit/tizen/20161018.031723
authorJeongmo Yang <jm80.yang@samsung.com>
Tue, 18 Oct 2016 01:54:18 +0000 (10:54 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Tue, 18 Oct 2016 01:54:18 +0000 (10:54 +0900)
In general, module is not closed to reuse.
But, it causes system idle memory down.
So, add code to close module for some requests after requests.

[Version] 0.1.21
[Profile] Common
[Issue Type] Update
[Dependency module] N/A
[Dependency commit] N/A
[Test] [M(T) - Boot=(OK), sdb=(OK), Home=(OK), Touch=(OK), Version=tizen-mobile_20161016.2]

Change-Id: Idb1ee2002863507f4fa327aaf02b153977b94604
Signed-off-by: Jeongmo Yang <jm80.yang@samsung.com>
packaging/mused.spec
src/muse_core_ipc.c
src/muse_core_module.c

index 469dcd7..e4c1ebd 100644 (file)
@@ -1,6 +1,6 @@
 Name:       mused
 Summary:    A Multimedia Daemon in Tizen Native API
-Version:    0.1.20
+Version:    0.1.21
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index 8384e2e..161b0fc 100644 (file)
@@ -145,6 +145,9 @@ static gpointer _muse_core_ipc_dispatch_worker(gpointer data)
                                                                module->api_module = api_module;
                                                                module->ch[MUSE_CHANNEL_DATA].queue = g_queue_new();
                                                                g_mutex_init(&module->ch[MUSE_CHANNEL_DATA].mutex);
+
+                                                               value = muse_core_module_get_instance()->get_dllsymbol_loaded_value(api_module);
+
                                                                module->ch[MUSE_CHANNEL_MSG].dll_handle = muse_core_module_get_instance()->load(api_module);
                                                        }
                                                }
@@ -153,6 +156,12 @@ static gpointer _muse_core_ipc_dispatch_worker(gpointer data)
 
                                                if (module->is_create_api_called == false) {
                                                        LOGE("<<< ### _muse_core_ipc_client_cleanup [module %p] [get_dllsymbol_loaded_value %d]", module, value);
+
+                                                       if (!value) {
+                                                               LOGW("release module dll handle");
+                                                               muse_core_module_get_instance()->close(module);
+                                                       }
+
                                                        _muse_core_ipc_client_cleanup(module);
                                                }
                                                break;
index 104549b..7094998 100644 (file)
@@ -83,14 +83,14 @@ static gboolean _muse_core_module_close(muse_module_h module)
 {
        g_return_val_if_fail(module != NULL, FALSE);
 
-       _muse_core_module_set_dllsymbol_loaded_value(module->api_module, module->ch[MUSE_CHANNEL_MSG].dll_handle, false);
-
        LOGD("Closing module %s", g_module_name(module->ch[MUSE_CHANNEL_MSG].dll_handle));
        if (!g_module_close(module->ch[MUSE_CHANNEL_MSG].dll_handle)) {
                LOGE("Couldn't close dll_handle %s: %s", g_module_name(module->ch[MUSE_CHANNEL_MSG].dll_handle), g_module_error());
                return FALSE;
        }
 
+       _muse_core_module_set_dllsymbol_loaded_value(module->api_module, NULL, false);
+
        return TRUE;
 }
 static GModule *_muse_core_module_get_dllsymbol(int api_module)
@@ -102,12 +102,12 @@ static GModule *_muse_core_module_get_dllsymbol(int api_module)
 static void _muse_core_module_set_dllsymbol_loaded_value(int api_module, GModule *module, gboolean value)
 {
        g_return_if_fail(g_muse_core_module!= NULL);
-       g_return_if_fail(module != NULL);
 
        g_muse_core_module->module_loaded[api_module] = value;
        g_muse_core_module->module[api_module] = module;
        LOGD("dll_handle: %p", g_muse_core_module->module[api_module]);
 }
+
 static gboolean _muse_core_module_get_dllsymbol_loaded_value(int api_module)
 {
        g_return_val_if_fail(g_muse_core_module != NULL, false);