aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/string.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2018-01-01 21:51:47 -0500
committerAustin Clements <austin@google.com>2018-02-15 21:12:26 +0000
commitd7691d055a7ab39a0d437eb5e20751dc1e339c2a (patch)
tree0ba675a54e6cd9a50345d3040604177c1f550aea /src/runtime/string.go
parent90666b8a3d5545f4295d9c2517ad607ce5d45e52 (diff)
downloadgo-d7691d055a7ab39a0d437eb5e20751dc1e339c2a.tar.gz
go-d7691d055a7ab39a0d437eb5e20751dc1e339c2a.zip
runtime: replace _MaxMem with maxAlloc
Now that we have memLimit, also having _MaxMem is a bit confusing. Replace it with maxAlloc, which better conveys what it limits. We also define maxAlloc slightly differently: since it's now clear that it limits allocation size, we can account for a subtle difference between 32-bit and 64-bit. Change-Id: Iac39048018cc0dae7f0919e25185fee4b3eed529 Reviewed-on: https://go-review.googlesource.com/85890 Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rick Hudson <rlh@golang.org>
Diffstat (limited to 'src/runtime/string.go')
-rw-r--r--src/runtime/string.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/runtime/string.go b/src/runtime/string.go
index 22be091375..97909196e9 100644
--- a/src/runtime/string.go
+++ b/src/runtime/string.go
@@ -266,7 +266,7 @@ func rawbyteslice(size int) (b []byte) {
// rawruneslice allocates a new rune slice. The rune slice is not zeroed.
func rawruneslice(size int) (b []rune) {
- if uintptr(size) > _MaxMem/4 {
+ if uintptr(size) > maxAlloc/4 {
throw("out of memory")
}
mem := roundupsize(uintptr(size) * 4)
@@ -395,7 +395,7 @@ func findnull(s *byte) int {
if s == nil {
return 0
}
- p := (*[_MaxMem/2 - 1]byte)(unsafe.Pointer(s))
+ p := (*[maxAlloc/2 - 1]byte)(unsafe.Pointer(s))
l := 0
for p[l] != 0 {
l++
@@ -407,7 +407,7 @@ func findnullw(s *uint16) int {
if s == nil {
return 0
}
- p := (*[_MaxMem/2/2 - 1]uint16)(unsafe.Pointer(s))
+ p := (*[maxAlloc/2/2 - 1]uint16)(unsafe.Pointer(s))
l := 0
for p[l] != 0 {
l++
@@ -424,7 +424,7 @@ func gostringnocopy(str *byte) string {
func gostringw(strw *uint16) string {
var buf [8]byte
- str := (*[_MaxMem/2/2 - 1]uint16)(unsafe.Pointer(strw))
+ str := (*[maxAlloc/2/2 - 1]uint16)(unsafe.Pointer(strw))
n1 := 0
for i := 0; str[i] != 0; i++ {
n1 += encoderune(buf[:], rune(str[i]))