Closed aarzilli closed 1 year ago
I see two possible fixes:
smallints > 0
check in Int.get and makeSmallInt.Hi @adonovan, thanks for your reply. Are there any instructions on how could I disable the optimization statically via the go build flag?
Something like this:
diff --git a/starlark/int_generic.go b/starlark/int_generic.go
--- a/starlark/int_generic.go
+++ b/starlark/int_generic.go
@@ -1,4 +1,4 @@
-//+build !linux,!darwin,!dragonfly,!freebsd,!netbsd,!solaris darwin,arm64 !amd64,!arm64,!mips64x,!ppc64x
+//+build !linux,!darwin,!dragonfly,!freebsd,!netbsd,!solaris darwin,arm64 !amd64,!arm64,!mips64x,!ppc64x StarlarkIntNoMmap
diff --git a/starlark/int_posix64.go b/starlark/int_posix64.go
--- a/starlark/int_posix64.go
+++ b/starlark/int_posix64.go
@@ -1,5 +1,6 @@
//+build linux darwin dragonfly freebsd netbsd solaris
//+build amd64 arm64,!darwin mips64x ppc64x
+//+build !StarlarkIntNoMmap
$ go build -tags=StarlarkIntNoMmap
Reference: https://github.com/go-delve/delve/issues/2907
The code in int_posix64.go assumes that the program has the ability to make a 4G allocation, this is not necessarily the case if the system is using ulimit to limit the amount of memory that processes can allocate. Given that this is an optimization the interpreter should be able to continue functioning even if the allocation fails (possibly attempting a smaller allocation first?)