Commit 8f82bff5 authored by Dmitriy Vyukov's avatar Dmitriy Vyukov

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
parent aa3d05ac
......@@ -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;
}
......
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