You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Even the smallest program compiled with 8g segfaults when run under limited memory,
memory that should still be enough to allocate large amounts of memory by the program.
What steps will reproduce the problem?
(peter) ~/go cat hello.go
package main
import "fmt"
func main() {
fmt.Println("Hello, 世界")
}
(peter) ~/go 8g hello.go
(peter) ~/go 8l -o hello hello.8
(peter) ~/go ./hello
Hello, 世界
(peter) ~/go ulimit -v 500000
(peter) ~/go ./hello
throw: runtime: SysReserve returned unaligned address
Segmentation fault
(peter) ~/go
What is the expected output?
Hello, 世界
What do you see instead?
throw: runtime: SysReserve returned unaligned address
Which compiler are you using (5g, 6g, 8g, gccgo)?
8g
Which operating system are you using?
i686 GNU/Linux
Which revision are you using? (hg identify)
9d7967223815 (release-branch.r57) release/release.r57.2
Please provide any additional information below.
Running the program 'hello' compiled with Go release 56 gives a different error:
throw: runtime: cannot reserve arena virtual address space
Segmentation fault
Doing the same thing on Linux 64, with 'hello' compiled with 6g does not cause these
problems, not even with only a tenth of the value for ulimit.
On Linux 32 (8g):
ulimit -v 800000 # program still runs
ulimit -v 700000 # segmentation fault
On Linux 64 (6g):
ulimit -v 40000 # program still runs.
ulimit -v 30000 # no segfault, but output: Killed
ulimit -v 10000 # other programs still run, like a small text editor
ulimit -v 9000 # other programs start failing with memory problems
The text was updated successfully, but these errors were encountered:
ulimit -v does not limit the amount of memory a
program can use. It limits the amount of virtual
address space a program can use.
Go's memory allocator reserves a lot of virtual
address space, to simplify its implementation,
but it does not use it all for 'hello, world'.
I don't expect that to change.
I can't explain why 32-bit and 64-bit Linux are
behaving differently for you.
I tested it on another linux machine, also 386. I got the same results. Programs run
normally with ulimit -v 800000, and give segmentation fault with ulimit -v 700000.
On 32-bit linux, the programs needs 20 times the amount of virtual address space as on
64-bit linux. You say, you can't explain why. So the status of this issue should be
"unexplained", not "unfortunate".
On a web server running many complex processes, I use ulimit -v 500000, to prevent
misbehaving programs from bringing the web site down. That is why I noticed this thing
with Go.
The text was updated successfully, but these errors were encountered: