aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/runtime/gc_none.go
blob: ab0b4b4038e5d80098b983099cc693eae8171b9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//go:build gc.none
// +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"
)

const gcAsserts = false // perform sanity checks

var gcTotalAlloc uint64 // for runtime.MemStats
var gcMallocs uint64
var gcFrees uint64

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.
}

func markRoots(start, end uintptr) {
	// dummy, so that markGlobals will compile
}