Off Heap / no GC


(Ash G) #1
  1. Is it possible to go off heap (similar to Java), that is manage your own memory in Go (without GC)?

  2. If yes, what is the api or the way to do it?


(Johann Forster) #2

Have a look at https://github.com/golang/go/issues/13761
Short answer: No.


(Jakob Borg) #3

Sure you can. A simple google search gives lots of potential packages with different use cases:

The question is more “for what purpose” and “why”? :slight_smile:


(Holloway) #4

I’m curious, is it possible to develop a “shim” layer for Go binary to operate as it is? I’m looking from TinyGo perspective to use Go for microcontroller. If those codes can be developed in Go, that would be nice. (Currently they are in embedded C).

EDIT: I would try to avoid hacking Go like TinyGo did to the heap memory part. It’s not easy to master memory mapping theorem.