memory

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package memory provides the typego:memory module for shared memory and stats.

Index

Constants

This section is empty.

Variables

View Source
var Types []byte

Functions

func Register

func Register(vm *sobek.Runtime, el *eventloop.EventLoop, f *Factory)

Register injects the typego:memory module into the runtime.

Types

type Factory

type Factory struct {
	// contains filtered or unexported fields
}

Factory manages shared memory segments for an engine instance.

func NewFactory

func NewFactory() *Factory

NewFactory creates a new memory factory.

func (*Factory) MakeShared

func (f *Factory) MakeShared(name string, size int) *SharedSegment

MakeShared gets or creates a shared memory segment.

type Module

type Module struct {
	Factory *Factory
}

Module implements the typego:memory module.

func (*Module) GetStats

func (m *Module) GetStats(vm *sobek.Runtime) func(sobek.FunctionCall) sobek.Value

GetStats returns memory statistics to JS.

type SharedSegment

type SharedSegment struct {
	Data []byte
	Mu   sync.RWMutex
}

SharedSegment represents a named block of memory shared between Go and JS.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL