1
0
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:
Dmitriy Vyukov 2012-11-16 20:06:11 +04:00
parent aa3d05acc9
commit 8f82bff545

View File

@ -34,9 +34,16 @@ static bool onstack(uintptr argp);
void
runtime·raceinit(void)
{
uintptr sz;
m->racecall = true;
runtimerace·Initialize();
runtimerace·MapShadow(noptrdata, enoptrbss - noptrdata);
sz = (byte*)&runtime·mheap - noptrdata;
if(sz)
runtimerace·MapShadow(noptrdata, sz);
sz = enoptrbss - (byte*)(&runtime·mheap+1);
if(sz)
runtimerace·MapShadow(&runtime·mheap+1, sz);
m->racecall = false;
}