From: Kern Sibbald Date: Wed, 15 Mar 2017 14:31:32 +0000 (+0100) Subject: Improve mem pool garbage collection X-Git-Tag: Release-7.4.7~1 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=c9eb7c54948a2c070b6f422bb6a4119b49cd9e08;p=bacula%2Fbacula Improve mem pool garbage collection --- diff --git a/bacula/src/dird/job.c b/bacula/src/dird/job.c index 7558d362d7..60c70f18ad 100644 --- a/bacula/src/dird/job.c +++ b/bacula/src/dird/job.c @@ -1,7 +1,7 @@ /* Bacula(R) - The Network Backup Solution - Copyright (C) 2000-2015 Kern Sibbald + Copyright (C) 2000-2017 Kern Sibbald The original author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -1467,6 +1467,8 @@ void dird_free_jcr(JCR *jcr) free_plugins(jcr); /* release instantiated plugins */ + garbage_collect_memory_pool(); + Dmsg0(200, "End dird free_jcr\n"); } diff --git a/bacula/src/filed/job.c b/bacula/src/filed/job.c index bcc72b1b94..a5974e24d2 100644 --- a/bacula/src/filed/job.c +++ b/bacula/src/filed/job.c @@ -1,7 +1,7 @@ /* Bacula(R) - The Network Backup Solution - Copyright (C) 2000-2015 Kern Sibbald + Copyright (C) 2000-2017 Kern Sibbald The original author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. diff --git a/bacula/src/lib/mem_pool.c b/bacula/src/lib/mem_pool.c index a2e7606889..5d7028cb33 100644 --- a/bacula/src/lib/mem_pool.c +++ b/bacula/src/lib/mem_pool.c @@ -375,7 +375,8 @@ void garbage_collect_memory_pool() return; } now = time(NULL); - if (now >= last_garbage_collection + garbage_interval) { + if (now >= last_garbage_collection + garbage_interval || + sm_bytes > 500000) { last_garbage_collection = now; V(mutex); garbage_collect_memory(); diff --git a/bacula/src/stored/fd_cmds.c b/bacula/src/stored/fd_cmds.c index 630f5e0476..1b6bfe8787 100644 --- a/bacula/src/stored/fd_cmds.c +++ b/bacula/src/stored/fd_cmds.c @@ -1,7 +1,7 @@ /* Bacula(R) - The Network Backup Solution - Copyright (C) 2000-2016 Kern Sibbald + Copyright (C) 2000-2017 Kern Sibbald The original author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. @@ -161,6 +161,7 @@ bail_out: Dmsg1(100, "==== %s", dir->msg); dir->signal(BNET_EOD); /* send EOD to Director daemon */ free_plugins(jcr); /* release instantiated plugins */ + garbage_collect_memory_pool(); return; }