mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 11:07:46 +00:00
runtime: add "none" garbage collector
This collector does not implement runtime.alloc, so it is a quick-and-dirty way to check where in a program memory is allocated.
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
// +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) 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.
|
||||
}
|
||||
Reference in New Issue
Block a user