From 3e5f60265511a66e3e5185790a306c3ce4d74a4d Mon Sep 17 00:00:00 2001 From: Dan Kegel Date: Thu, 3 Mar 2022 15:19:25 -0800 Subject: [PATCH] gc_leaking.go: don't inline alloc. Fixes #2674. --- src/runtime/gc_leaking.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/runtime/gc_leaking.go b/src/runtime/gc_leaking.go index b2abfd0c8..799525362 100644 --- a/src/runtime/gc_leaking.go +++ b/src/runtime/gc_leaking.go @@ -14,6 +14,9 @@ import ( // Ever-incrementing pointer: no memory is freed. var heapptr = heapStart +// Inlining alloc() speeds things up slightly but bloats the executable by 50%, +// see https://github.com/tinygo-org/tinygo/issues/2674. So don't. +//go:noinline func alloc(size uintptr, layout unsafe.Pointer) unsafe.Pointer { // TODO: this can be optimized by not casting between pointers and ints so // much. And by using platform-native data types (e.g. *uint8 for 8-bit