assume_no_moving_gc

package module
Version: v0.0.0-...-1025295 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 22, 2020 License: BSD-3-Clause Imports: 0 Imported by: 2

README

go4.org/unsafe/assume-no-moving-gc

If your Go package wants to declare that it plays unsafe games that only work if the Go runtime's garbage collector is not a moving collector, then add:

import _ "go4.org/unsafe/assume-no-moving-gc"

Then your program will explode if that's no longer the case. (Users can override the explosion with a scary sounding environment variable.)

This also gives us a way to find all the really gross unsafe packages.

Documentation

Overview

Package go4.org/unsafe/assume-no-moving-gc exists so you can depend on it from unsafe code that wants to declare that it assumes that the Go runtime does not using a moving garbage colllector.

This package is then updated for new Go versions when that is still the case and explodes at runtime with a failure otherwise, unless an environment variable overrides it.

To use:

import _ "go4.org/unsafe/assume-no-moving-gc"

There is no API.

The GitHub repo is at https://github.com/go4org/unsafe-assume-no-moving-gc

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to