github.com/ncruces/go-sqlite3@v0.15.1-0.20240520133447-53eef1510ff0/internal/util/mmap_other.go (about)

     1  //go:build !(darwin || linux) || !(amd64 || arm64 || riscv64) || sqlite3_noshm || sqlite3_nosys
     2  
     3  package util
     4  
     5  import (
     6  	"context"
     7  
     8  	"github.com/tetratelabs/wazero/experimental"
     9  )
    10  
    11  type mmapState struct{}
    12  
    13  func withAllocator(ctx context.Context) context.Context {
    14  	return experimental.WithMemoryAllocator(ctx,
    15  		experimental.MemoryAllocatorFunc(func(cap, max uint64) experimental.LinearMemory {
    16  			if cap == max {
    17  				return virtualAlloc(cap, max)
    18  			}
    19  			return sliceAlloc(cap, max)
    20  		}))
    21  }