Merge branch 'develop' into future

This commit is contained in:
Neil 2023-09-03 13:18:47 +01:00 committed by GitHub
commit 9defa35c66
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 2 deletions

View File

@ -5,7 +5,6 @@ import (
"encoding/json" "encoding/json"
"net" "net"
"regexp" "regexp"
"runtime/debug"
"github.com/gologme/log" "github.com/gologme/log"
@ -43,7 +42,7 @@ func (m *Yggdrasil) StartAutoconfigure() error {
// StartJSON starts a node with the given JSON config. You can get JSON config // StartJSON starts a node with the given JSON config. You can get JSON config
// (rather than HJSON) by using the GenerateConfigJSON() function // (rather than HJSON) by using the GenerateConfigJSON() function
func (m *Yggdrasil) StartJSON(configjson []byte) error { func (m *Yggdrasil) StartJSON(configjson []byte) error {
debug.SetMemoryLimit(1024 * 1024 * 40) setMemLimitIfPossible()
logger := log.New(m.log, "", 0) logger := log.New(m.log, "", 0)
logger.EnableLevel("error") logger.EnableLevel("error")

View File

@ -0,0 +1,10 @@
//go:build go1.20
// +build go1.20
package mobile
import "runtime/debug"
func setMemLimitIfPossible() {
debug.SetMemoryLimit(1024 * 1024 * 40)
}

View File

@ -0,0 +1,8 @@
//go:build !go1.20
// +build !go1.20
package mobile
func setMemLimitIfPossible() {
// not supported by this Go version
}