From c80f5b9bf7c67e1338d04bc0cf21fe285c3a80df Mon Sep 17 00:00:00 2001 From: Carl Shapiro Date: Thu, 4 Apr 2013 14:18:52 -0700 Subject: [PATCH] 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 --- src/pkg/runtime/malloc.goc | 4 ++-- 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<start<start< 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<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; -- 2.50.0