add compile-time flag to disable Go GC (MR 56)

I hate this, but it's the only good way I could find to allow working around this ugly QEMU bug:
https://gitlab.com/qemu-project/qemu/-/issues/2560
This commit is contained in:
Clayton Craft
2024-09-28 08:11:19 -07:00
parent 741c0553d5
commit d63e600614
2 changed files with 13 additions and 0 deletions

View File

@@ -9,6 +9,8 @@ import (
"log"
"os"
"path/filepath"
"runtime/debug"
"strings"
"time"
"gitlab.com/postmarketOS/postmarketos-mkinitfs/internal/archive"
@@ -26,8 +28,14 @@ import (
// set at build time
var Version string
var DisableGC string
func main() {
// To allow working around silly GC-related issues, like https://gitlab.com/qemu-project/qemu/-/issues/2560
if strings.ToLower(DisableGC) == "true" {
debug.SetGCPercent(-1)
}
retCode := 0
defer func() { os.Exit(retCode) }()