mirror of
https://github.com/golang/go
synced 2024-11-26 14:08:37 -07:00
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
This commit is contained in:
parent
e242562506
commit
eb04df75cd
@ -2274,7 +2274,11 @@ runfinq(void)
|
|||||||
framesz = sizeof(uintptr) + f->nret;
|
framesz = sizeof(uintptr) + f->nret;
|
||||||
if(framecap < framesz) {
|
if(framecap < framesz) {
|
||||||
runtime·free(frame);
|
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;
|
framecap = framesz;
|
||||||
}
|
}
|
||||||
*(void**)frame = f->arg;
|
*(void**)frame = f->arg;
|
||||||
|
Loading…
Reference in New Issue
Block a user