aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/mcache.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/mcache.go')
-rw-r--r--src/runtime/mcache.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/runtime/mcache.go b/src/runtime/mcache.go
index 440120cdfe..a1d04d2f8a 100644
--- a/src/runtime/mcache.go
+++ b/src/runtime/mcache.go
@@ -253,6 +253,14 @@ func (c *mcache) allocLarge(size uintptr, noscan bool) *mspan {
// Put the large span in the mcentral swept list so that it's
// visible to the background sweeper.
mheap_.central[spc].mcentral.fullSwept(mheap_.sweepgen).push(s)
+
+ // Adjust s.limit down to the object-containing part of the span.
+ //
+ // This is just to create a slightly tighter bound on the limit.
+ // It's totally OK if the garbage collector, in particular
+ // conservative scanning, can temporarily observes an inflated
+ // limit. It will simply mark the whole object or just skip it
+ // since we're in the mark phase anyway.
s.limit = s.base() + size
s.initHeapBits()
return s