]> Cypherpunks repositories - gostls13.git/commit
runtime: avoid zeroing scavenged memory
authorLance Yang <ioworker0@gmail.com>
Tue, 28 Oct 2025 08:02:13 +0000 (08:02 +0000)
committert hepudds <thepudds1460@gmail.com>
Fri, 31 Oct 2025 12:33:04 +0000 (05:33 -0700)
commit27937289dc9fccf1f5513475145799087f39b964
tree5da79b938b9556fe17cd1b69b4b7173333c6caea
parent89dee70484669d546fff6ca29a4717368af351ff
runtime: avoid zeroing scavenged memory

On Linux, memory returned to the kernel via MADV_DONTNEED is guaranteed
to be zero-filled on its next use.

This commit leverages this kernel behavior to avoid a redundant software
zeroing pass in the runtime, improving performance.

Change-Id: Ia14343b447a2cec7af87644fe8050e23e983c787
GitHub-Last-Rev: 6c8df322836e70922c69ca3c5aac36e4b8a0839a
GitHub-Pull-Request: golang/go#76063
Reviewed-on: https://go-review.googlesource.com/c/go/+/715160
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: David Chase <drchase@google.com>
src/runtime/arena.go
src/runtime/mem.go
src/runtime/mem_aix.go
src/runtime/mem_bsd.go
src/runtime/mem_darwin.go
src/runtime/mem_linux.go
src/runtime/mem_sbrk.go
src/runtime/mem_windows.go
src/runtime/mheap.go