diff options
| author | Carl Shapiro <cshapiro@google.com> | 2013-04-04 14:18:52 -0700 |
|---|---|---|
| committer | Carl Shapiro <cshapiro@google.com> | 2013-04-04 14:18:52 -0700 |
| commit | c80f5b9bf7c67e1338d04bc0cf21fe285c3a80df (patch) | |
| tree | 296108257e181e3d4a3fab393f721fb1f56a4941 /src/pkg/runtime | |
| parent | 13d6f8f7f324a5dba5e5c3c1f72d7f09b07846e9 (diff) | |
| download | go-c80f5b9bf7c67e1338d04bc0cf21fe285c3a80df.tar.xz | |
runtime: use a distinct pattern to mark free blocks in need of zeroing
R=golang-dev, dvyukov, khr, cshapiro
CC=golang-dev
https://golang.org/cl/8392043
Diffstat (limited to 'src/pkg/runtime')
| -rw-r--r-- | src/pkg/runtime/malloc.goc | 4 | ||||
| -rw-r--r-- | src/pkg/runtime/mgc0.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/pkg/runtime/malloc.goc b/src/pkg/runtime/malloc.goc index a30129ffc1..f1d25a793f 100644 --- a/src/pkg/runtime/malloc.goc +++ b/src/pkg/runtime/malloc.goc @@ -160,7 +160,7 @@ runtime·free(void *v) if(sizeclass == 0) { // Large object. size = s->npages<<PageShift; - *(uintptr*)(s->start<<PageShift) = 1; // mark as "needs to be zeroed" + *(uintptr*)(s->start<<PageShift) = (uintptr)0xfeedfeedfeedfeedll; // mark as "needs to be zeroed" // Must mark v freed before calling unmarkspan and MHeap_Free: // they might coalesce v into other spans and change the bitmap further. runtime·markfreed(v, size); @@ -170,7 +170,7 @@ runtime·free(void *v) // Small object. size = runtime·class_to_size[sizeclass]; if(size > sizeof(uintptr)) - ((uintptr*)v)[1] = 1; // mark as "needs to be zeroed" + ((uintptr*)v)[1] = (uintptr)0xfeedfeedfeedfeedll; // mark as "needs to be zeroed" // Must mark v freed before calling MCache_Free: // it might coalesce v and other blocks into a bigger span // and change the bitmap further. diff --git a/src/pkg/runtime/mgc0.c b/src/pkg/runtime/mgc0.c index 2d129eb8ed..caf1b10e34 100644 --- a/src/pkg/runtime/mgc0.c +++ b/src/pkg/runtime/mgc0.c @@ -1607,7 +1607,7 @@ sweepspan(ParFor *desc, uint32 idx) if(cl == 0) { // Free large span. runtime·unmarkspan(p, 1<<PageShift); - *(uintptr*)p = 1; // needs zeroing + *(uintptr*)p = (uintptr)0xdeaddeaddeaddeadll; // needs zeroing runtime·MHeap_Free(runtime·mheap, s, 1); c->local_alloc -= size; c->local_nfree++; @@ -1622,7 +1622,7 @@ sweepspan(ParFor *desc, uint32 idx) break; } if(size > sizeof(uintptr)) - ((uintptr*)p)[1] = 1; // mark as "needs to be zeroed" + ((uintptr*)p)[1] = (uintptr)0xdeaddeaddeaddeadll; // mark as "needs to be zeroed" end->next = (MLink*)p; end = (MLink*)p; |
