daemon : modify gdbm cache size to reduce memory usage 82/73882/2
authorJiwoong Im <jiwoong.im@samsung.com>
Fri, 10 Jun 2016 02:09:42 +0000 (11:09 +0900)
committerJiwoong Im <jiwoong.im@samsung.com>
Mon, 13 Jun 2016 02:08:55 +0000 (19:08 -0700)
Change-Id: I292c3ae041b0dd6df3c6e470c342206a62e92879
Signed-off-by: Jiwoong Im <jiwoong.im@samsung.com>
backend/gdbm.c

index 877fc52..1c9a698 100644 (file)
@@ -43,6 +43,8 @@ static GDBM_FILE open_gdbm(const char *dbpath)
 {
        GDBM_FILE db;
        char *nm;
+       int cache_size;
+       int r;
 
        assert(dbpath);
 
@@ -70,6 +72,11 @@ static GDBM_FILE open_gdbm(const char *dbpath)
                return NULL;
        }
 
+       cache_size = 50;
+       r = gdbm_setopt(db, GDBM_CACHESIZE, &cache_size, sizeof(cache_size));
+       if (r == -1)
+               bxt_err("Set option failed: %s", gdbm_strerror(gdbm_errno));
+
        g_hash_table_insert(dbs, nm, db);
 
        bxt_dbg("Open '%s'", dbpath);