go:wasmexport alloc
(n uint32)
| 48 | |
| 49 | //go:wasmexport alloc |
| 50 | func alloc(n uint32) uint32 { |
| 51 | if n == 0 { |
| 52 | return 0 |
| 53 | } |
| 54 | b := make([]byte, n) |
| 55 | ptr := uint32(uintptr(unsafe.Pointer(&b[0]))) |
| 56 | keep[ptr] = b |
| 57 | return ptr |
| 58 | } |
| 59 | |
| 60 | //go:wasmexport dealloc |
| 61 | func dealloc(ptr uint32, _ uint32) { |