mirror of
https://github.com/golang/go
synced 2024-11-22 10:04:42 -07:00
runtime: fix tiny memory leak
The m->cret word holds the C return value when returning across a stack split boundary. It was not being cleared after use, which means that the return value (if a C function) or else the value of AX/R0 at the time of the last stack unsplit was being kept alive longer than necessary. Clear it. I think the effect here should be very small, but worth fixing anyway. R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5677092
This commit is contained in:
parent
efacb2a1b4
commit
89b075cc90
@ -1011,6 +1011,7 @@ runtime·oldstack(void)
|
|||||||
{
|
{
|
||||||
Stktop *top, old;
|
Stktop *top, old;
|
||||||
uint32 argsize;
|
uint32 argsize;
|
||||||
|
uintptr cret;
|
||||||
byte *sp;
|
byte *sp;
|
||||||
G *g1;
|
G *g1;
|
||||||
int32 goid;
|
int32 goid;
|
||||||
@ -1034,7 +1035,9 @@ runtime·oldstack(void)
|
|||||||
g1->stackbase = old.stackbase;
|
g1->stackbase = old.stackbase;
|
||||||
g1->stackguard = old.stackguard;
|
g1->stackguard = old.stackguard;
|
||||||
|
|
||||||
runtime·gogo(&old.gobuf, m->cret);
|
cret = m->cret;
|
||||||
|
m->cret = 0; // drop reference
|
||||||
|
runtime·gogo(&old.gobuf, cret);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called from reflect·call or from runtime·morestack when a new
|
// Called from reflect·call or from runtime·morestack when a new
|
||||||
|
Loading…
Reference in New Issue
Block a user