Skip to content

Commit bb7fb8a

Browse files
runtime: print error if mmap fails
Fixes #49687 Change-Id: Ife7f64f4c98449eaff7327e09bc1fb67acee72c9 Reviewed-on: https://go-review.googlesource.com/c/go/+/379354 Trust: Ian Lance Taylor <[email protected]> Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Austin Clements <[email protected]>
1 parent c1296af commit bb7fb8a

File tree

4 files changed

+4
-0
lines changed

4 files changed

+4
-0
lines changed

src/runtime/mem_aix.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ func sysMap(v unsafe.Pointer, n uintptr, sysStat *sysMemStat) {
7272
throw("runtime: out of memory")
7373
}
7474
if err != 0 {
75+
print("runtime: mprotect(", v, ", ", n, ") returned ", err, "\n")
7576
throw("runtime: cannot map pages in arena address space")
7677
}
7778
}

src/runtime/mem_bsd.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ func sysMap(v unsafe.Pointer, n uintptr, sysStat *sysMemStat) {
7373
throw("runtime: out of memory")
7474
}
7575
if p != v || err != 0 {
76+
print("runtime: mmap(", v, ", ", n, ") returned ", p, ", ", err, "\n")
7677
throw("runtime: cannot map pages in arena address space")
7778
}
7879
}

src/runtime/mem_darwin.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ func sysMap(v unsafe.Pointer, n uintptr, sysStat *sysMemStat) {
6666
throw("runtime: out of memory")
6767
}
6868
if p != v || err != 0 {
69+
print("runtime: mmap(", v, ", ", n, ") returned ", p, ", ", err, "\n")
6970
throw("runtime: cannot map pages in arena address space")
7071
}
7172
}

src/runtime/mem_linux.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ func sysMap(v unsafe.Pointer, n uintptr, sysStat *sysMemStat) {
189189
throw("runtime: out of memory")
190190
}
191191
if p != v || err != 0 {
192+
print("runtime: mmap(", v, ", ", n, ") returned ", p, ", ", err, "\n")
192193
throw("runtime: cannot map pages in arena address space")
193194
}
194195
}

0 commit comments

Comments
 (0)