X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Flib%2Fhtable.c;h=a42ec022d0c82e5d30156a1ae70deeeb90cc3dd7;hb=897707854a8240d026e933215009f931bb9c5762;hp=850a721060ed523416991a5af9783a74cb65a9ca;hpb=8389a0a17cf014fd75f169d08014e7d0d9cf6823;p=bacula%2Fbacula diff --git a/bacula/src/lib/htable.c b/bacula/src/lib/htable.c index 850a721060..a42ec022d0 100644 --- a/bacula/src/lib/htable.c +++ b/bacula/src/lib/htable.c @@ -6,7 +6,7 @@ The main author of Bacula is Kern Sibbald, with contributions from many others, a complete list can be found in the file AUTHORS. This program is Free Software; you can redistribute it and/or - modify it under the terms of version two of the GNU General Public + modify it under the terms of version three of the GNU Affero General Public License as published by the Free Software Foundation and included in the file LICENSE. @@ -15,7 +15,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Affero General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -49,9 +49,12 @@ */ #include "bacula.h" - #include "htable.h" +#define PAGE_SIZE 4096 +#define MAX_PAGES 2400 +#define MAX_BUF_SIZE (MAX_PAGES * PAGE_SIZE) /* approx 10MB */ + static const int dbglvl = 500; /* =================================================================== @@ -103,10 +106,10 @@ char *htable::hash_malloc(int size) if (mem_block->rem < asize) { uint32_t mb_size; - if (total_size >= 1000000) { - mb_size = 1000000; + if (total_size >= (MAX_BUF_SIZE / 2)) { + mb_size = MAX_BUF_SIZE; } else { - mb_size = 100000; + mb_size = MAX_BUF_SIZE / 2; } malloc_big_buf(mb_size); } @@ -168,7 +171,7 @@ void htable::init(void *item, void *link, int tsize) table = (hlink **)malloc(buckets * sizeof(hlink *)); memset(table, 0, buckets * sizeof(hlink *)); #ifdef BIG_MALLOC - malloc_big_buf(1000000); /* ***FIXME*** need variable or some estimate */ + malloc_big_buf(MAX_BUF_SIZE); /* ***FIXME*** need variable or some estimate */ #endif }