From a50224537bbb5845cb99d853efc4e5f0b5c995f8 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Fri, 10 Oct 2025 14:49:05 +0200 Subject: [PATCH] compileopts: lower "large stack" limit to 16kb I'm running with `-stack-size 16kb` and running into excessive allocations because the otherwise non-escaping buffer in https://github.com/golang/go/blob/c53cb642deea152e28281133bc0053f5ec0ce358/src/crypto/internal/fips140/sha512/sha512block.go#L97 is moved to the heap. --- compileopts/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compileopts/config.go b/compileopts/config.go index c94523f72e..7ce7ae5470 100644 --- a/compileopts/config.go +++ b/compileopts/config.go @@ -226,7 +226,7 @@ func (c *Config) StackSize() uint64 { // MaxStackAlloc returns the size of the maximum allocation to put on the stack vs heap. func (c *Config) MaxStackAlloc() uint64 { - if c.StackSize() > 32*1024 { + if c.StackSize() >= 16*1024 { return 1024 }