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
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;
}