From a450f843ee57645db062a4fe472c4509a7a1c7a2 Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Mon, 18 May 2015 10:37:47 -0600 Subject: Change min mmap size from 1MB to 32KB. This commit adjusts the minimum mmap size from 1MB to 32KB. The previous limit was arbitrary and causes wasted space for very small databases. Thanks to @mcuadros for submitting the original pull request: https://github.com/boltdb/bolt/pull/351 --- db.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db.go b/db.go index b78640f..5b905be 100644 --- a/db.go +++ b/db.go @@ -256,8 +256,8 @@ func (db *DB) munmap() error { // of the database. The minimum size is 1MB and doubles until it reaches 1GB. // Returns an error if the new mmap size is greater than the max allowed. func (db *DB) mmapSize(size int) (int, error) { - // Double the size from 1MB until 1GB. - for i := uint(20); i <= 30; i++ { + // Double the size from 32KB until 1GB. + for i := uint(15); i <= 30; i++ { if size <= 1<