aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDmitriy Vyukov <dvyukov@google.com>2013-07-19 18:01:33 +0400
committerDmitriy Vyukov <dvyukov@google.com>2013-07-19 18:01:33 +0400
commiteb04df75cd87722f396fb66583279afe5abfb1ca (patch)
tree317e1835521779b7f8e7a2c0c25d078883546303 /src
parente2425625067c633bae000a6210b7fb21d6f76d74 (diff)
downloadgo-eb04df75cd87722f396fb66583279afe5abfb1ca.tar.xz
runtime: prevent GC from seeing the contents of a frame in runfinq
This holds the last finalized object and arguments to its finalizer. Fixes #5348. R=golang-dev, iant CC=golang-dev https://golang.org/cl/11454044
Diffstat (limited to 'src')
-rw-r--r--src/pkg/runtime/mgc0.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/pkg/runtime/mgc0.c b/src/pkg/runtime/mgc0.c
index f2c5939e0a..abf93e425b 100644
--- a/src/pkg/runtime/mgc0.c
+++ b/src/pkg/runtime/mgc0.c
@@ -2274,7 +2274,11 @@ runfinq(void)
framesz = sizeof(uintptr) + f->nret;
if(framecap < framesz) {
runtime·free(frame);
- frame = runtime·mal(framesz);
+ // The frame does not contain pointers interesting for GC,
+ // all not yet finalized objects are stored in finc.
+ // If we do not mark it as FlagNoPointers,
+ // the last finalized object is not collected.
+ frame = runtime·mallocgc(framesz, FlagNoPointers, 0, 1);
framecap = framesz;
}
*(void**)frame = f->arg;