mirror of
https://github.com/golang/go
synced 2024-11-22 23:50:03 -07:00
runtime: hide mheap from race detector
This significantly decreases amount of shadow memory mapped by race detector. I haven't tested on Windows, but on Linux it reduces virtual memory size from 1351m to 330m for fmt.test. Fixes #4379. R=golang-dev, alex.brainman, iant CC=golang-dev https://golang.org/cl/6849057
This commit is contained in:
parent
aa3d05acc9
commit
8f82bff545
@ -34,9 +34,16 @@ static bool onstack(uintptr argp);
|
||||
void
|
||||
runtime·raceinit(void)
|
||||
{
|
||||
uintptr sz;
|
||||
|
||||
m->racecall = true;
|
||||
runtime∕race·Initialize();
|
||||
runtime∕race·MapShadow(noptrdata, enoptrbss - noptrdata);
|
||||
sz = (byte*)&runtime·mheap - noptrdata;
|
||||
if(sz)
|
||||
runtime∕race·MapShadow(noptrdata, sz);
|
||||
sz = enoptrbss - (byte*)(&runtime·mheap+1);
|
||||
if(sz)
|
||||
runtime∕race·MapShadow(&runtime·mheap+1, sz);
|
||||
m->racecall = false;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user