Commit 8a4c2b3c authored by Russ Cox's avatar Russ Cox

runtime: fix another memory leak

morebuf holds a pc/sp from the last stack split or
reflect.call or panic/recover.  If the pc is a closure,
the reference will keep it from being collected.

moreargp holds a pointer to the arguments from the
last stack split or reflect.call or panic/recover.
Normally it is a stack pointer and thus not of interest,
but in the case of reflect.call it is an allocated argument
list and holds up the arguments to the call.

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5674109
parent 4e3f8e91
...@@ -1103,6 +1103,9 @@ runtime·newstack(void) ...@@ -1103,6 +1103,9 @@ runtime·newstack(void)
top->argp = m->moreargp; top->argp = m->moreargp;
top->argsize = argsize; top->argsize = argsize;
top->free = free; top->free = free;
m->moreargp = nil;
m->morebuf.pc = nil;
m->morebuf.sp = nil;
// copy flag from panic // copy flag from panic
top->panic = g1->ispanic; top->panic = g1->ispanic;
...@@ -1114,7 +1117,7 @@ runtime·newstack(void) ...@@ -1114,7 +1117,7 @@ runtime·newstack(void)
sp = (byte*)top; sp = (byte*)top;
if(argsize > 0) { if(argsize > 0) {
sp -= argsize; sp -= argsize;
runtime·memmove(sp, m->moreargp, argsize); runtime·memmove(sp, top->argp, argsize);
} }
if(thechar == '5') { if(thechar == '5') {
// caller would have saved its LR below args. // caller would have saved its LR below args.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment