gc_none.mx raw

   1  //go:build gc.none
   2  
   3  package runtime
   4  
   5  // This GC strategy provides no memory allocation at all. It can be useful to
   6  // detect where in a program memory is allocated (via linker errors) or for
   7  // targets that have far too little RAM even for the leaking memory allocator.
   8  
   9  import (
  10  	"unsafe"
  11  )
  12  
  13  const needsStaticHeap = false
  14  
  15  var gcTotalAlloc uint64 // for runtime.MemStats
  16  var gcMallocs uint64
  17  var gcFrees uint64
  18  
  19  func alloc(size uintptr, layout unsafe.Pointer) unsafe.Pointer
  20  
  21  func realloc(ptr unsafe.Pointer, size uintptr) unsafe.Pointer
  22  
  23  func free(ptr unsafe.Pointer) {
  24  	// Nothing to free when nothing gets allocated.
  25  }
  26  
  27  func GC() {
  28  	// Unimplemented.
  29  }
  30  
  31  func markRoots(start, end uintptr) {
  32  	runtimePanic("unreachable: markRoots")
  33  }
  34  
  35  func SetFinalizer(obj interface{}, finalizer interface{}) {
  36  	// Unimplemented.
  37  }
  38  
  39  func initHeap() {
  40  	// Nothing to initialize.
  41  }
  42  
  43  func setHeapEnd(newHeapEnd uintptr) {
  44  	// Nothing to do here, this function is never actually called.
  45  }
  46