]> Cypherpunks repositories - gostls13.git/commitdiff
internal/poll: avoid tiny allocator for splicePipe
authorIan Lance Taylor <iant@golang.org>
Fri, 22 Oct 2021 21:19:34 +0000 (14:19 -0700)
committerIan Lance Taylor <iant@golang.org>
Mon, 25 Oct 2021 21:03:33 +0000 (21:03 +0000)
We want to set a finalizer on splicePipe, so make it large enough to
not use the tiny allocator. Otherwise the finalizer will not run until
the rest of the tiny allocation can be freed. This only matters on
32-bit systems.

Fixes #48968

Change-Id: I8eb3c9f48fdccab7dc79c5b918d4257b6151ee91
Reviewed-on: https://go-review.googlesource.com/c/go/+/358114
Trust: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
src/internal/poll/splice_linux.go

index 8062d98fae945ccf214dc095ed8165e83dd556ad..6869a40b243c0beeba0b597b9e2b74893c94aca7 100644 (file)
@@ -158,6 +158,10 @@ type splicePipe struct {
        rfd  int
        wfd  int
        data int
+
+       // We want to use a finalizer, so ensure that the size is
+       // large enough to not use the tiny allocator.
+       _ [24 - 3*unsafe.Sizeof(int(0))]byte
 }
 
 // splicePipePool caches pipes to avoid high-frequency construction and destruction of pipe buffers.