Source file src/runtime/mem_wasm.go
1 // Copyright 2023 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package runtime 6 7 import "unsafe" 8 9 func sbrk(n uintptr) unsafe.Pointer { 10 grow := divRoundUp(n, physPageSize) 11 size := growMemory(int32(grow)) 12 if size < 0 { 13 return nil 14 } 15 resetMemoryDataView() 16 return unsafe.Pointer(uintptr(size) * physPageSize) 17 } 18 19 // Implemented in src/runtime/sys_wasm.s 20 func growMemory(pages int32) int32 21