3 ms·
There is no slide about writing the GC in Go. How do you write a GC in a GC'd language?
by haberman 11y ago
There is no slide about writing the GC in Go.
How do you write a GC in a GC'd language?
- Zikes 11y agoSlide #9 mentions they use the unsafe package in the GC to deal with pointers as raw bits.
- haberman 11y agoBut does the GC run on the GC's own runtime data? Can the GC be interrupted by itself if it takes too long or uses too much memory? It seems like there are several things about the GC that would need to be special-cased, since the GC is implicitly invoked by the runtime.
- kinghajj 11y agoI would assume not. GCs are typically invoked by requesting allocation. Since the GC (presumably) uses lower-level OS facilities to allocate memory, it wouldn't need to recursively invoke itself.
- the_why_of_y 11y agoThe usual way to do it is to define a restricted subset of the language that has explicit memory management and is statically typed, and implement GC with that. For example, Pre-Scheme and RPython. http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.3.4031 http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.3.40... https://en.wikipedia.org/wiki/PyPy#RPython https://en.wikipedia.org/wiki/PyPy#RPython