Pull Request已成功合入, 合并人@openeuler-ci-bot
(感谢 cyf_123123 的贡献)Welcome To openEuler Community
Hey @qq_44302067 , thanks for your contribution to the community.
Bot Usage Manual
I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands.
Contact Guide
If you have any questions, please contact the SIG: sig-golang ,
and any of the maintainers: @genedna, @jing-rui ,
and any of the committers: @fuowang, @wd-gitcode .


门禁正在运行, 您可以通过以下链接查看实时门禁检查结果.
若您对门禁结果含义不清晰或者遇到问题不知如何解决,可参考门禁指导手册
门禁入口及编码规范检查: multiarch/openeuler/trigger/golang/50/console


请先解决代码冲突


/ai help


/ai review


🟡 Medium Priority
TryClearSpanFunc 通过 allocmcache() 获取 mcache,其 alloc[spc] 指向全局 emptymspan(见 mcache.go:95 初始化逻辑)。测试直接修改 emptymspan.needzero 并对其调用 clearSpanFunc,这会触发 memclrNoHeapPointers(unsafe.Pointer(0), 0)。虽然各平台 memclrNoHeapPointers 实现对 size=0 均安全返回,但修改全局 emptymspan 破坏了测试隔离性,并行测试下可能触发 race detector 报警,且 emptymspan.needzero 被永久修改可能影响后续依赖该值的逻辑。
同一段代码其他问题
导出的变量 Class_to_size / Size_to_class8 / Size_to_class128 未被使用:这三个变量在该文件及整个 diff 范围内均未被任何测试引用,属于无用的导出,增加维护负担并可被误认为有外部依赖。


门禁正在运行, 您可以通过以下链接查看实时门禁检查结果.
若您对门禁结果含义不清晰或者遇到问题不知如何解决,可参考门禁指导手册
门禁入口及编码规范检查: multiarch/openeuler/trigger/golang/69/console


/lgtm
/approve


runtime: add ClearSpan experiment to clear spans on first allocation
This change introduces the ClearSpan GOEXPERIMENT, which clears an
entire span when the first object is allocated from a span that still
requires zeroing.
The ClearSpan path moves zeroing work from each individual small
allocation to the first allocation from the span. Once the span is
cleared, needzero is reset so later allocations from the same span can
avoid repeated per-object clearing. Tiny allocation zeroing is also
adjusted to avoid redundant clearing when the span has already been
zeroed.
Tests are added to validate that ClearSpan resets needzero and clears
the backing memory only when the experiment is enabled.