Debian Codegraph @

allocator/nonmoving_slice.go

raw symbols SCIP
1 package allocator
2
3 import "github.com/tetratelabs/wazero/experimental"
4
5 // Separate implementation of non-Unix/Windows code to file without
6 // build tag to allow testing on any platform.
7
8 func sliceAlloc(_, max uint64) experimental.LinearMemory {
9 buf := make([]byte, max)
10 return &sliceBuffer{buf: buf[:0]}
11 }
12
13 type sliceBuffer struct {
14 buf []byte
15 }
16
17 func (b *sliceBuffer) Free() {}
18
19 func (b *sliceBuffer) Reallocate(size uint64) []byte {
20 return b.buf[:size]
21 }