diff --git a/pkg/database/database.go b/pkg/database/database.go index 641d938..5ff2bb6 100644 --- a/pkg/database/database.go +++ b/pkg/database/database.go @@ -58,6 +58,12 @@ func New( // Set BlockCacheSize to a moderate value and keep BlockSize small. opts.BlockCacheSize = int64(256 * units.Mb) // 256 MB cache opts.BlockSize = 4 * units.Kb // 4 KB block size + // Prevent huge allocations during table building and memtable flush. + // Badger's TableBuilder buffer is sized by BaseTableSize; ensure it's small. + opts.BaseTableSize = 64 * units.Mb // 64 MB per table (default ~2MB, increased for fewer files but safe) + opts.MemTableSize = 64 * units.Mb // 64 MB memtable to match table size + // Keep value log files to a moderate size as well + opts.ValueLogFileSize = 256 * units.Mb // 256 MB value log files opts.CompactL0OnClose = true opts.LmaxCompaction = true opts.Compression = options.None diff --git a/pkg/version/version b/pkg/version/version index bbe495d..b094544 100644 --- a/pkg/version/version +++ b/pkg/version/version @@ -1 +1 @@ -v0.8.8 \ No newline at end of file +v0.8.9 \ No newline at end of file