mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 02:57:46 +00:00
0f69d016a0
When using the latest wasi-libc I experienced a panic on an attempt to call realloc. My first attempt to add it to arch_tinygowasm.go was obviously not good (PR #2194). So here is another suggestion.
40 lines
831 B
Go
40 lines
831 B
Go
// +build gc.none
|
|
|
|
package runtime
|
|
|
|
// This GC strategy provides no memory allocation at all. It can be useful to
|
|
// detect where in a program memory is allocated, or to combine this runtime
|
|
// with a separate (external) garbage collector.
|
|
|
|
import (
|
|
"unsafe"
|
|
)
|
|
|
|
func alloc(size uintptr, layout unsafe.Pointer) unsafe.Pointer
|
|
|
|
func realloc(ptr unsafe.Pointer, size uintptr) unsafe.Pointer
|
|
|
|
func free(ptr unsafe.Pointer) {
|
|
// Nothing to free when nothing gets allocated.
|
|
}
|
|
|
|
func GC() {
|
|
// Unimplemented.
|
|
}
|
|
|
|
func KeepAlive(x interface{}) {
|
|
// Unimplemented. Only required with SetFinalizer().
|
|
}
|
|
|
|
func SetFinalizer(obj interface{}, finalizer interface{}) {
|
|
// Unimplemented.
|
|
}
|
|
|
|
func initHeap() {
|
|
// Nothing to initialize.
|
|
}
|
|
|
|
func setHeapEnd(newHeapEnd uintptr) {
|
|
// Nothing to do here, this function is never actually called.
|
|
}
|