From 60c3069dd82eee30c00f2a8d829ba74b11bcf07e Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 22 Oct 2021 14:19:34 -0700 Subject: [PATCH] internal/poll: avoid tiny allocator for splicePipe 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 Run-TryBot: Ian Lance Taylor TryBot-Result: Go Bot Reviewed-by: Bryan C. Mills --- src/internal/poll/splice_linux.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/internal/poll/splice_linux.go b/src/internal/poll/splice_linux.go index 8062d98fae..6869a40b24 100644 --- a/src/internal/poll/splice_linux.go +++ b/src/internal/poll/splice_linux.go @@ -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. -- 2.50.0