mmm: reduce default mmap size.

This commit is contained in:
fiatjaf
2026-03-30 08:10:08 -03:00
parent 117a304f68
commit d1fdc262f2
2 changed files with 3 additions and 4 deletions
+1 -1
View File
@@ -61,7 +61,7 @@ func (il *IndexingLayer) Init() error {
env.SetMaxDBs(9) env.SetMaxDBs(9)
env.SetMaxReaders(1000) env.SetMaxReaders(1000)
env.SetMapSize(1 << 38) // ~273GB env.SetMapSize(MMAP_INFINITE_SIZE)
// create directory if it doesn't exist and open it // create directory if it doesn't exist and open it
if err := os.MkdirAll(path, 0755); err != nil { if err := os.MkdirAll(path, 0755); err != nil {
+2 -3
View File
@@ -4,7 +4,6 @@ import (
"encoding/binary" "encoding/binary"
"errors" "errors"
"fmt" "fmt"
"math"
"os" "os"
"path/filepath" "path/filepath"
"slices" "slices"
@@ -51,7 +50,7 @@ func (b *MultiMmapManager) String() string {
} }
const ( const (
MMAP_INFINITE_SIZE = math.MaxInt MMAP_INFINITE_SIZE = 100_000_000_000
maxuint16 = 65535 maxuint16 = 65535
maxuint32 = 4294967295 maxuint32 = 4294967295
) )
@@ -106,7 +105,7 @@ func (b *MultiMmapManager) Init() error {
env.SetMaxDBs(3) env.SetMaxDBs(3)
env.SetMaxReaders(1000) env.SetMaxReaders(1000)
env.SetMapSize(1 << 38) // ~273GB env.SetMapSize(MMAP_INFINITE_SIZE)
err = env.Open(dbpath, lmdb.NoTLS, 0644) err = env.Open(dbpath, lmdb.NoTLS, 0644)
if err != nil { if err != nil {