mirror of
https://github.com/ncruces/go-sqlite3.git
synced 2026-01-12 05:59:14 +00:00
- enabled by default on 64-bit macOS and Linux (`amd64`/`arm64`) - depends on merged but unreleased wazero - may cause small performance regression - users may need WithMemoryLimitPages if not enough address space available - needs docs
22 lines
427 B
Go
22 lines
427 B
Go
package util
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/tetratelabs/wazero/experimental"
|
|
)
|
|
|
|
type moduleKey struct{}
|
|
type moduleState struct {
|
|
handleState
|
|
mmapState
|
|
}
|
|
|
|
func NewContext(ctx context.Context, mappableMemory bool) context.Context {
|
|
state := new(moduleState)
|
|
ctx = context.WithValue(ctx, moduleKey{}, state)
|
|
ctx = experimental.WithCloseNotifier(ctx, state)
|
|
ctx = state.mmapState.init(ctx, mappableMemory)
|
|
return ctx
|
|
}
|